Search code examples
c#outlookvstooutlook-addin

Hide header text and header toolbar in Outlook addin


I was searching for few days and cannot find any solution. Do you know how to hide the header text and header "toolbar" in the adjoining Outlook addin?

enter image description here

I dont want to have the text "My custom addin" and i dont want to have this "+" and line.


Solution

  • You might be happier with a "Custom Task Pane." It still has some UI associated with it, but it's prettier.

    enter image description here

    Or, you can use a blank space (ie. " ") for the title:

    enter image description here

    To create one, create a UserControl in your project. That's MyTaskPane below. Then, in your ThisAddIn class, create the task pane for windows that you want it on. The following would create the task pane on every window.

    You should also remove the task panes when each window closes as described in the MSDN documentation.

    public partial class ThisAddIn
    {
        Inspectors _inspectors;
    
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            MyTaskPane pane = new MyTaskPane();
            var taskPane = this.CustomTaskPanes.Add(pane, "My Custom Task Pane");
            taskPane.Visible = true;
    
            _inspectors = Application.Inspectors;
            _inspectors.NewInspector += Inspectors_NewInspector;
        }
    
        void Inspectors_NewInspector(Outlook.Inspector Inspector)
        {
            MyTaskPane pane = new MyTaskPane();
            var taskPane = this.CustomTaskPanes.Add(pane, "My Custom Task Pane", Inspector);
            taskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionBottom;
            taskPane.Visible = true;
        }
    
        private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
        {
        }
    
        #region VSTO generated code
    
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InternalStartup()
        {
            this.Startup += new System.EventHandler(ThisAddIn_Startup);
            this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
        }
    
        #endregion
    }