locked
How to cutomize Navigation Pane ? RRS feed

  • Question

  • Hi,

    I am using following code to insert a CustomTaskPane in the Navigation Pane :

       
    Code Snippet

    public partial class ThisAddIn
        {
            private Microsoft.Office.Tools.CustomTaskPane taskPane = null;

            private void ThisAddIn_Startup(object sender, System.EventArgs e)
            {
                Outlook.Explorer explorer = this.Application.ActiveExplorer();
                Outlook.NavigationPane pane = explorer.NavigationPane;
                taskPane = this.CustomTaskPanes.Add(new MyPane(), "Custom My Pane", pane);
                taskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionBottom;
                taskPane.DockPositionRestrict = Office.MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoChange;
                taskPane.Height = 120;
                taskPane.Visible = true;
                taskPane.VisibleChanged += new EventHandler(taskPane_VisibleChanged);
            }

            void taskPane_VisibleChanged(object sender, EventArgs e)
            {
                taskPane.Visible = true;
            }

            private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
            {
                this.CustomTaskPanes.Remove(taskPane);
            }

            #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
        }



    But i am getting error :



    Value does not fall within the expected range.


    ************** Exception Text **************
    System.ArgumentException: Value does not fall within the expected range.
       at Microsoft.Office.Tools.ICustomTaskPaneSite.CreateTaskPane(Object control, String title, Object window)
       at Microsoft.Office.Tools.CustomTaskPaneAdapter..ctor(IRuntimeServiceProvider runtimeServiceProvider, UserControl control, String title, Object window)
       at Microsoft.Office.Tools.CustomTaskPaneFactoryAdapter.Microsoft.Office.Tools.ICustomTaskPaneFactoryContract.Create(UserControl control, String title, Object window)
       at Microsoft.Office.Tools.CustomTaskPaneCollection.AddHelper(UserControl control, String title, Object window)
       at Microsoft.Office.Tools.CustomTaskPaneCollection.Add(UserControl control, String title, Object window)
       at CustomTaskPaneAddIn.ThisAddIn.ThisAddIn_Startup(Object sender, EventArgs e) in C:\CustomTaskPaneAddIn\CustomTaskPaneAddIn\ThisAddIn.cs:line 17
       at Microsoft.Office.Tools.AddIn.OnStartup()
       at CustomTaskPaneAddIn.ThisAddIn.FinishInitialization() in C:\CustomTaskPaneAddIn\CustomTaskPaneAddIn\ThisAddIn.Designer.cs:line 72
       at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.ExecutePhase(String methodName)
       at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.ExecuteEntryPointsHelper()
       at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.Microsoft.VisualStudio.Tools.Applications.Runtime.IExecuteCustomization2.ExecuteEntryPoints()




    Tuesday, January 29, 2008 12:10 PM

Answers

  • There is no mechanism built into Outlook to do this. Whether something like that is possible solely with Windows UI programming probably would take a considerable amount of research to determine, as nothing about how Outlook draws its UI is documented or exposed in an API. I would suggest that you use the CTP mechanism as it's designed.
    Wednesday, January 30, 2008 2:59 PM

All replies

  • It is not possible to create a task pane inside the navigation pane. The last parameter for CustomTaskPanes.Add must be either an Explorer or an Inspector.
    Tuesday, January 29, 2008 2:29 PM
  • Is there any way by which this can be done ? May be through overriding the core implementation (may be catching some events) by which Outlook renders the UI
    Wednesday, January 30, 2008 4:49 AM
  • There is no mechanism built into Outlook to do this. Whether something like that is possible solely with Windows UI programming probably would take a considerable amount of research to determine, as nothing about how Outlook draws its UI is documented or exposed in an API. I would suggest that you use the CTP mechanism as it's designed.
    Wednesday, January 30, 2008 2:59 PM