none
is there any way to show Sepaerate form region when inspector window for an appointment opens? RRS feed

  • Question

  • Hi

    I am creating a separate form region(Using visual studio 2010) for outlook 2010. is there any way to show a separate form region when Inspector windows open?

    unlike adjoining form region, i have to press a button and then my seperate form region seems to appear in form region collection and then it shows up.

    is there any way to do it automatically?

    Thanks

    Friday, May 18, 2012 3:18 PM

Answers

  • on some inspector event (open, activate, depends on your logic) call inspector.ShowFormPage("My.Full.Namespace.RegionName");
    • Proposed as answer by Prashanth Iyer Monday, May 21, 2012 8:28 AM
    • Marked as answer by Nitrup Monday, May 21, 2012 9:07 AM
    Saturday, May 19, 2012 11:40 AM

All replies

  • on some inspector event (open, activate, depends on your logic) call inspector.ShowFormPage("My.Full.Namespace.RegionName");
    • Proposed as answer by Prashanth Iyer Monday, May 21, 2012 8:28 AM
    • Marked as answer by Nitrup Monday, May 21, 2012 9:07 AM
    Saturday, May 19, 2012 11:40 AM
  • Hi DamianD,

    Thanks! But I keep getting the exception "The specified page does not exist or does not allow that operation". I gave the Namespace.FormRegionName. What is Full Namespace?? Pardon me for asking something like this.

    I am able to see myFormRegion when I type Namespace.<here>    and passed the same as the string parameter. Any idea what I am doing wrong?



    Sunday, May 20, 2012 2:40 PM
  • show us declaration of your region class with namespace and code that tries to show that region
    Sunday, May 20, 2012 5:52 PM
  • EDIT: Hey, I figured out the problem. The "Name" property of my form was set to the string I was passing, but the "FormRegionName" was set to something else. I corrected the property value and the error dissapeared, but the form was still not being displayed..

    I then used  inspector.SetCurrentFormPage("Namespace.FormRegionName")

    and it worked! Thanks again :)

    ==============================================================

    // The code that tries to show the region is in the same namespace as the region.

    // The below code is part of a ribbon in my addin
    namespace ServiceRequestAddin
    {

        public partial class ribbonSR
        {

             private void CreateSR_Load(object sender, RibbonUIEventArgs e)
            {
              
            }

            private void button1_Click(object sender, RibbonControlEventArgs e) 
            {

            // Getting the handle of outlook and storing it in the currentOutlook object.
            Outlook.Application currentOutlook = Globals.ThisAddIn.Application;

             // Creating a new appointment item and storing in oMsg object.           
             Outlook.AppointmentItem oMsg = (Outlook.AppointmentItem) currentOutlook.CreateItem (Outlook.OlItemType.olAppointmentItem);
      
            // Displaying the appointment item
            oMsg.Display();

             // ?? Created an inspector object because appointment item cannot call ShowFormPage
            Outlook.Inspector appointmentItem = currentOutlook.ActiveInspector();
             appointmentItem.ShowFormPage("ServiceRequestAddin.");

             }
        }
    }

    ======================================

    // The below code is there in my formRegion.cs

    // It is the same as adding a new formregion to your project and

    // having some GUI with no code behind yet.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Office = Microsoft.Office.Core;
    using Outlook = Microsoft.Office.Interop.Outlook;

    namespace ServiceRequestAddin
    {
        partial class formCreateSR
        {
            #region Form Region Factory

            [Microsoft.Office.Tools.Outlook.FormRegionMessageClass(Microsoft.Office.Tools.Outlook.FormRegionMessageClassAttribute.Appointment)]
            [Microsoft.Office.Tools.Outlook.FormRegionName("ServiceRequestAddin.formCreateSR")]
            public partial class formCreateSRFactory
            {           
                private void formCreateSRFactory_FormRegionInitializing(object sender, Microsoft.Office.Tools.Outlook.FormRegionInitializingEventArgs e)
                {
                }
            }

            #endregion
           
            private void formCreateSR_FormRegionShowing(object sender, System.EventArgs e)
            {
            }

            private void formCreateSR_FormRegionClosed(object sender, System.EventArgs e)
            {
            }
        }
    }

    ============================================

    All slings and arrows gratefully received.Thanks







    Monday, May 21, 2012 5:26 AM
  • great to hear - mark an answer so thread will be closed :)
    Monday, May 21, 2012 7:32 AM