Modifying Outlook 2010 view with Delphi forms

Add-in Express™ Extensions
for Microsoft® Outlook®

Customizing an Outlook view in Delphi

Add-in Express Extensions for Microsoft Outlook empowers you to customize / modify Outlook forms and folder views programmatically by embedding Delphi forms (TForm) into all Outlook versions, Outlook 2010, Outlook 2007 - 2000. You can add custom forms into one, several or all Outlook views (Explorer windows) and forms (Inspector windows). All Delphi versions from 5 to XE3 are supported.

Customize Outlook folder views using view regions

The Extensions for Outlook allows you to replace the folder pane of the selected folder with your custom form. In Microsoft Outlook, the folder pane is the area where different items, (such as messages, tasks, notes) of the selected Outlook folder are shown. This resembles the customization provided by Outlook Today, but the Extensions offers a much higher level of customization.

Outlook folder pane

Also, with the Add-in Express Extensions you can embed your custom form into a view region of a selected Outlook folder, as shown below.

Embedding a custom form into an Outlook view region

Embedding a custom form into Outlook view regions

The VCL Extensions supports embedding multiple forms into multiple view regions (top, bottom, left or right). Below you can see a step-by-step instruction on how to embed your VCL custom forms into Outlook view regions in Delphi.

1. Add the Outlook Forms Manager to the add-in module

The Extensions for Outlook adds the TadxOlFormsManager (Outlook Forms Manager) component onto the Add-in Express VCL tab in the Component Palette. To include the Add-in Express Extensions functionality in your add-in project you just add this component onto your add-in module. This adds the Outlook Forms Manager component to the add-in module.

Adding the Outlook Forms Manager

The Outlook Forms Manager (TadxOlFormsManager) centralizes all your forms and binds them to Outlook folders. The component provides several Outlook-specific properties and events such as:

  • Items collection. Each item of this collection binds a form of the TadxOlForm class to its own folder set. For an instance of TadxOlForm to be embedded into regions for any given Outlook folder view(s), its class should be specified for one or more items of this collection that bind the TadxOlForm instances to appropriate folders through ExplorerItemTypes, FolderName and FolderNames properties.
  • CurrentForm. Returns a reference to the TadxOlForm instance if it exists in the current view region of the current Outlook Explorer window / view. Returns nil if no form instances exist in the current view.
  • OutlookAppObj. Returns a reference to the Outlook.Application object that hosts your add-in.
  • ADXBeforeFolderSwitch event. Occurs before the Explorer window goes to a new folder, either as a result of a user action or through the program code. You can use this event to choose another form class for the folder to be switched to.
  • ADXFolderSwitch. Occurs after the Outlook Explorer window goes to a new folder, either as a result of a user action or through the program code. You can use this event to control your form visibility depending on conditions determined by your add-in functionality. Also, you can cancel your form showing up in this event.
  • ADXNewInspector. Occurs whenever a new Outlook inspector window is opened, either as a result of user action or through program code.

2. Create and customize a new Outlook form

The Add-in Express Extensions provides a special form class, TadxOlForm, derived from TForm and used for creating custom forms embeddable into Outlook view region. You add custom forms to your project using the Extensions for Outlook tab in the "New Items" dialog box (File | New | Other...):

Creating a custom Outlook form

On the created form you can use any Delphi controls and components including data grids, list views, edit and combo boxes, etc.

Custom Outlook form

In addition to the properties and events of TForm, the TadxOlForm class (ADX Outlook Form) provides several Outlook-specific properties and events such as:

  • ExplorerObj. Returns a reference to the Outlook Explorer object if the from is shown up in the Explorer window.
  • FolderObj. Returns a reference to the current folder object.
  • FolderItemsObj. Returns a reference to the Items collection of the FolderObj.
  • OutlookAppObj. Returns a reference to the Outlook.Application object that hosts your add-in.
  • FormsManager. Returns a reference to the Outlook Forms Manager component.
  • Item. Returns a reference to the item of the Items collection of the Outlook Forms Manager component.
  • ADXBeforeFormShow and ADXAfterFormShow events. Occur each time before / after the form is shown.
  • ADXSelectionChange. Retranslates the Outlook.SelectionChange event to the form. For example, you can use this event to react to selection changes when the user switches to a different item in a folder using the user interface.

3. Bind your form to Outlook folders

To specify the folders for which your form is displayed, you add a new item to the Items collection of the Outlook Forms Manager, select your form class in the FormClassName property and specify Outlook folder via three special properties: FolderName, FoldersNames and ExplorerItemTypes. These properties are common for all Outlook-related components provided by Add-in Express.

Then, with the ExplorerLayout property you specify the view region of Outlook that the form is placed on:

Binding your custom form to Outlook folders

4. Run your Outlook add-in

Run your add-in and select one of the specified folders:

Running your Outlook add-in

Have any questions? Ask us right now!