How to: Prevent Outlook from Displaying a Form Region

There might be situations in which you do not want Microsoft Office Outlook to display a form region for a particular item. For example, if a contact item does not contain a business address, you can prevent a form region that shows the location of the business in a map from appearing.

Applies to: The information in this topic applies to application-level projects for Outlook 2013 and Outlook 2010. For more information, see Features Available by Office Application and Project Type.

To prevent Outlook from displaying a form region

  1. Open the code file for the form region you want to modify.

  2. Expand the Form Region Factory code region.

  3. Add code to the FormRegionInitializing event handler that sets the Cancel property of the FormRegionInitializingEventArgs class to true.

In this example, if the contact item does not contain an address, the Cancel property is set to true, and the form region does not appear.

private void MapItFactory_FormRegionInitializing(object sender,
    Microsoft.Office.Tools.Outlook.FormRegionInitializingEventArgs e)
    Outlook.ContactItem myItem = (Outlook.ContactItem)e.OutlookItem;

    if (myItem != null)
        if ((myItem.BusinessAddress != null &&
                myItem.BusinessAddress.Trim().Length > 0) ||
            (myItem.HomeAddress != null && 
                myItem.HomeAddress.Trim().Length > 0) ||
            (myItem.OtherAddress != null && 
                myItem.OtherAddress.Trim().Length > 0))

    e.Cancel = true;