Binding custom forms to Outlook Explorer
and Inspector windows in .NET: C#, VB

Add-in Express™ Extensions
for Microsoft® Outlook®

Add-in Express Home >

Binding custom forms to Outlook windows

This page shows how you use Add-in Express Extensions for Outlook to bind your custom forms to Outlook windows.

To embed your custom form into Outlook windows, you add a new item to the Items collection of the Outlook Forms Manager and bind it to your form's class and the Outlook Explorer or / and Inspector window via special properties of the added item. All properties of items of the Outlook Forms Manager's Items collection are described below.

Property, event or method

Description

Cached property

Defines a caching strategy for your form. Applies to folder regions only. Cached strategies are described below.

Enabled property

Enables / disable embedding your form.

ExplorerItemTypes property

Specifies the types of Outlook folders which your form is embedded into. Applies to folder regions only.

ExplorerLayout property

Specifies the folder region that contains your form. Use WebViewPane to create a web view region, and RightSubpane, LeftSubpane, TopSubpane or BottomSubpane to create a folder view region. Applies to folder regions only.

FolderName, FolderNames properties

Specify names of the folders which your forms is embedded for. Applies to folder regions only.

FormClassName property

Specifies your form.

InspectorItemTypes property

Specifies the types of the built-in Outlook Inspector forms which your form is embedded into. Applies to Advanced Form Regions only.

InspectorLayout property

Specifies the sub-pane that contains your form. Use TopSubpane, LeftSubpane, RightSubpane or BottomSubpane to embed your form into a corresponding Advanced Form Region.

Applies to Advanced Form Regions only.

InspectorMessageClass, InspectorMessageClasses property

Specify the message classes of the custom Outlook forms that contain your form. The properties correspond to the MessageClass property in the Outlook Object Model and the MAPI property PR_MESSAGE_CLASS.

These properties allow you to embed your form into Advanced Form Regions of custom Outlook forms specified by their message class. Applies to Advanced Form Regions only.

Please note that with one item of the Items collection you can embed your custom form into the Outlook Explorer and Inspector windows simultaneously.

Binding .NET forms to Outlook folders

Remember that your custom form is bound to Outlook folders by an item of the Items collection of the Outlook Forms Manager. In addition, the Add-in Express Extensions for Outlook allows you to bind one form to several Outlook folders through several items of this collection. For example:

VB.NET


' Item #1 binds one form to all mail folders
Me.AdxOlFormsManager1.Items.Add(Me.AdxOlFormsCollectionItem1)
Me.AdxOlFormsCollectionItem1.ExplorerItemTypes = _

AddinExpress.OL.ADXOlExplorerItemTypes.olMailItem
Me.AdxOlFormsCollectionItem1.FormClassName = "ADXOlForm1"

' Item #2 binds the same form to the "Personal Folders\Special" folder
Me.AdxOlFormsManager1.Items.Add(Me.AdxOlFormsCollectionItem1)
Me.AdxOlFormsCollectionItem1.FolderName = "Personal Folders\Special"
Me.AdxOlFormsCollectionItem1.FormClassName = "ADXOlForm1"

What can you need it for? Using different items for binding the same form to Outlook folders you can create logical sets to control the form's behavior, to change bound folders, etc. For example, you can disable or enable your forms separately for all mail folders or for the "Personal Folders\Special" folder. Also, you can change a form's layout to place your form on the top folder view region for mail folders and on the bottom folder view region for the "Personal Folders\Special" folder. Another purpose is to replace the form class name. It gives you a possibility to dynamically and flexibly bind different forms to different folders.

How can you bind your forms to Outlook folders? First of all, you can do it via the Items collection designer of the Outlook Forms Manager, as shown above. If you need to do it by code (on-the-fly), you should handle the ADXBeforeFolderSwitch event of the Outlook Forms Manager and create new items, delete existing items, enable/disable them, bind to other folders, etc. In general, only in the handler of ADXBeforeFolderSwitch you can change the Items collection of the Outlook Forms Manager.