Form Region Displaying but unable to access programmatically RRS feed

  • Question

  • Hi, I've implemented a form region and it is displaying on outlook but when I want to access the form region in code the form region collection is empty. Globals.FormRegions returns no form regions.

    Tuesday, November 15, 2016 2:19 PM

All replies

  • Hello,

    What event handler do you use for accessing an instance of the form region? What code exactly do you have now?

    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Tuesday, November 15, 2016 2:23 PM
  • Hi GarthC,

    are you using VBA or VSTO?

    if you are using VBA try something like mentioned below to access user forms.

    Sub ListForms(fld As Outlook.MAPIFolder)
        Dim strList As String
        ' requires reference to Collaboration Data Objects library
        '   (CDO 1.21)
        Dim cdoSession As MAPI.Session
        Dim cdoFolder As MAPI.folder
        Dim cdoFilter As MAPI.MessageFilter
        Dim cdoMessages As MAPI.Messages
        Dim cdoMessage As MAPI.Message
        Const CdoPR_Form_Name = &H6800001E
        On Error Resume Next
        Set cdoSession = CreateObject("MAPI.Session")
        cdoSession.Logon "", "", False, False
        Set cdoFolder = cdoSession.GetFolder(fld.EntryID, fld.storeID)
        Set cdoMessages = cdoFolder.HiddenMessages
        For Each cdoMessage In cdoMessages
            If cdoMessage.Type = _
              "IPM.Microsoft.FolderDesign.FormsDescription" Then
                strList = strList & vbCrLf & _
            End If
        If Len(strList) > 0 Then
            strList = Mid(strList, 2)
            strList = "No forms found in folder"
        End If
        MsgBox strList, vbInformation, "Forms in " & fld.Name & " folder"
        Set cdoSession = Nothing
        Set cdoFolder = Nothing
        Set cdoMessage = Nothing
        Set cdoMessages = Nothing
    End Sub

    if you are using VSTO then you can use the code mentioned below.

            private void Access_Form_Regions_ByInspector()
                WindowFormRegionCollection formRegions = 
                formRegions.FormRegion1.textBox1.Text = "Hello World";


    Accessing a Form Region at Run Time

    Outlook Form Regions Overview



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Wednesday, November 16, 2016 8:20 AM