none
How to programatically open a Form Region from VSTO 2010 VB Add-in RRS feed

  • Question

  • Hi,

    I have an Outlook Add-In that I created in VSTO2010 VB.  This Add-In has multiple "Replacement" messages form regions that will be used as the initial fillable "Request For Service" form, Request for Additional Information and finally assignment of task.

    From the reading pane of the "Request For Service" form region, I want to be able click a button and open the form region for the "Request for Additional Information" and be able to send a message back to requestor.

    I had this working, but unfortunately, lost code after a harddrive crash.  Now when I attempt to recreate the Add-It, I can`t get this to work.

    Sample of  Code:

    Dim myItem As Outlook.MailItem

    MyItem = OutlookItem

    MyItem.GetInspector.SetCurrentFormPage("RequestForm.FormRegion3")

    MyItem.Display

    Error returned:

    "The specified page does not exist or does not allow that operation."

    Any help would be appreciated.

    Thanks,

    Dwayne

    Saturday, March 16, 2013 4:10 PM

All replies

  • i think that call to Display should be before trying to set active tab
    Monday, March 18, 2013 9:33 AM
  • Hi Damian, Thanks for your response. I have that a try and still receive the same error. Dwayne
    Monday, March 18, 2013 1:31 PM
  • Thanks for the link to the thread.

    After further investigation, it appears that the different form regions cannot see each other.  Even though they are part of the same ADD-IN.    

    Is there something I have to do to share the form regions?

    Tuesday, March 19, 2013 3:53 AM
  • what do you mean by 'sharing'  form regions?
    Tuesday, March 19, 2013 7:50 AM
  • Basically, when I attempt to call any of the form regions from another, the requested form cannot be seen. I attempted see the form region collection and can only see the form region I am reviewing the collection in.
    Tuesday, March 19, 2013 11:59 AM
  • what exactly do you mean by calling one form region from other? if both form regions originatge from your code, simply call functions on your class.
    Tuesday, March 19, 2013 1:29 PM
  • Both Form Regions are in the Add-in.   However, when I attempt to get the list of Form Regions from the "ThisFormRegionCollection", the only visible Form Region the one execting the code. 

    I know I am probably doing something that, so I created a basic project with two Form Regions and nothing else.

    The namespace for the project is RequestForService

    FormRegion1's Form Region Factory is as follows:

       <Microsoft.Office.Tools.Outlook.FormRegionMessageClass("IPM.Note.RequestForService.assign")> _
        <Microsoft.Office.Tools.Outlook.FormRegionName("RequestForService.FormRegion1")> _
        Partial Public Class FormRegion1Factory
            Private Sub InitializeManifest()
                Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(FormRegion1))
                Me.Manifest.FormRegionType = Microsoft.Office.Tools.Outlook.FormRegionType.Replacement
                Me.Manifest.Title = resources.GetString("Title")
                Me.Manifest.FormRegionName = resources.GetString("FormRegionName")
                Me.Manifest.Description = resources.GetString("Description")
                Me.Manifest.ShowInspectorCompose = True
                Me.Manifest.ShowInspectorRead = True
                Me.Manifest.ShowReadingPane = True
            End Sub

    FormRegion2's Form Region Factory is as follows:

        <Microsoft.Office.Tools.Outlook.FormRegionMessageClass("IPM.Note.RequestForService")> _
        <Microsoft.Office.Tools.Outlook.FormRegionName("RequestForService.FormRegion2")> _
        Partial Public Class FormRegion2Factory
            Public Sub InitializeManifest()
                Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(FormRegion2))
                Me.Manifest.FormRegionType = Microsoft.Office.Tools.Outlook.FormRegionType.Replacement
                Me.Manifest.Title = resources.GetString("Title")
                Me.Manifest.FormRegionName = resources.GetString("FormRegionName")
                Me.Manifest.Description = resources.GetString("Description")
                Me.Manifest.ShowInspectorCompose = True
                Me.Manifest.ShowInspectorRead = True
                Me.Manifest.ShowReadingPane = True
                Me.Manifest.Hidden = True
            End Sub

    The code to call FormRegion2 from FromRegion1 is as follows:

        Private Sub cmdSubmit_Click() Handles cmdSubmit.Click
            Dim myItem As Outlook.MailItem
            myItem = OutlookItem
            myitem.GetInspector.SetCurrentFormPage("RequestForService.FormRegion2")
        End Sub
    I hopefully it is something simple that I missed.

    Wednesday, March 20, 2013 4:00 AM
  • is "RequestForService.FormRegion2" full class name of class responsible for your region?

    Wednesday, March 20, 2013 5:55 AM
  • I believe so, but that is the problem. I have checked the properties of the project to get the namespace and I am getting the region name and from the  Region Factory.  Is there a better way to get the full name? 
    Wednesday, March 20, 2013 12:06 PM