Create custom Outlook inspector forms in C#, VB.NET:
contacts, appointments, mail in Outlook 2007, 2003

Add-in Express™ Extensions
for Microsoft® Outlook®

Add-in Express Home >

Creating custom Outlook forms

All Outlook developers would agree that customizing, or modifying, forms in Microsoft Outlook has always been a bit of a challenge. If you have ever tried to create a custom Outlook Inspector form other than mail, post, or contact forms, you were limited to adding additional tab pages to the standard page. Even if you have tried to modify the contact form, you were not able to replicate the look and feel of the standard Outlook form. Moreover, once you designed your custom form, you had to use notepad to write code behind the form.

The Add-in Express Extensions for Outlook gets over all these limitations and provides advanced customization for Outlook forms, including e-mail forms, contacts, appointments and tasks for Outlook 2007, Outlook 2003, 2002 (XP) and 2000. Now you can:

  • Embed your custom forms into top, left, bottom or right form regions of the Microsoft Outlook Inspector window, including mail, appointment, task, contact forms as well as other Microsoft Outlook built-in forms.
  • Embed your customized form into top, left, bottom or right form regions of any Microsoft Outlook custom forms defined by form classes.
  • Accessing the item contained by the Inspector window.

Below, you can see step-by-step example on how to quickly start creating custom forms for Outlook 2007, Outlook 2003, 2002 and 2000 with Advanced Form Regions provided by the Add-in Express Extensions for Outlook. Visual Studio .NET 2003, 2005 and 2008 (Visual Basic .NET, C#) are supported. Before we start, you may want to read more about:

Now, let's create a custom Outlook e-mail form.

1. Adding the Outlook Forms Manager

The Add-in Express Extensions for Outlook adds to the add-in module commands set a special command, "Add Outlook Forms Manager", available on the command area of the Properties window or by right-clicking the add-in module.

Adding the Outlook Forms Manager

To include the Add-in Express Extensions for Outlook functionality in your Outlook add-in project, select the add-in module and run the "Add Outlook Forms Manager" command. The command adds the Outlook Forms Manager component to the add-in module.

Adding the Outlook Forms Manager

2. Creating a custom form for embedding into Outlook form regions

Run the "ADX Outlook Form" wizard from the Add New Item dialog of the add-in project. The wizard adds a new form module to the add-in project.

Embedding a new Outlook form

3. Customizing the Outlook form

On your custom form, you can use any .NET controls such as calendars, edit boxes, grids, list views, etc. In this example we created a custom Outlook mail form by adding a label to show when the selected message was sent.

Customizing the Outlook form

4. Accessing the Outlook object

You access the base Outlook objects and events through the event handlers of the form instance of the ADXOlForm type. For example, you can handle the ADXBeforeShow event to initialize your form in the current Inspector window:

C#


private void ADXOlForm1_ADXBeforeFormShow()
{
 Outlook.Inspector Inspector = (Outlook.Inspector) InspectorObj;
 Outlook.MailItem Item = (Outlook.MailItem)Inspector.CurrentItem;
 SentLabel.Text = Item.Subject;
}

VB.NET


Private Sub ADXOlForm1_ADXBeforeShow() Handles Me.ADXBeforeShow
 Dim Inspector As Outlook.Inspector = CType(InspectorObj, Outlook.Inspector)
 Dim Item As Outlook.MailItem = CType(Inspector.CurrentItem, Outlook.MailItem)
 SentLabel.Text = Item.Subject
End Sub

5. Binding your custom form to Outlook form regions

To specify the Inspector window, which the customized form is displayed for, you add a new item to the Items collection of the Outlook Forms Manager, select the form class in the FormClassName property and specify an Outlook form via three special properties, InspectorItemTypes, InspectorMessageClass and InspectorMessageClasses.

Then, with the InspectorLayout property, you specify the region, which the form is placed on.

Binding your custom form to Outlook form regions

6. Run your Outlook add-in

Finally, you rebuild the add-in project, run Outlook and find your custom form embedded into the Outlook form region.