Microsoft Outlook Custom Forms
Forms are code and user interface templates that Outlook uses to display data stored in individual Outlook items. Every item that you open in Outlook uses a form to display information.
The forms designer is built into all versions of Outlook. You can launch a design session with the Tools | Forms | Design a Form command. Alternatively, open any Outlook item in Outlook 2003 or earlier and choose Tools | Forms | Design This Form.
In Outlook 2007, to design a form derived from an open item or to publish any form, you must first turn on the display of developer commands, and then look on the Developer tab in the ribbon for the Design This Form command: Choose Tools | Options, switch to the Other tab, click Advanced Options, and then select the Show Developer tab in the Ribbon check box.
Every form is based on existing form. The closest thing to a blank form is the post form.
Forms can have VBScript code behind them to react to user actions -- validating data, synchronizing it with databases, creating new Outlook items, etc. To add code, once you're in form design mode, click the View Code command on the toolbar or ribbon.
In an Exchange Server environment, custom forms are typically stored in the Organization Forms library, so that everyone has access to them. They can also be published directly to a folder. Personal forms are published either to a folder or to your Personal Forms library. Only published forms can run code.
My book, Microsoft Outlook Programming: Jumpstart for Administrators, Developers, and Power includes detailed chapters on creating custom Outlook forms.
These references also provide an introduction to the forms creation process:
Custom form code
Code behind Outlook forms uses VBScript, a slim, portable version of the Visual Basic programming language.
To add or modify code, open the form in design mode and then click the View Code command on the toolbar or ribbon. You can use the Script | Event Handler command to add an item-level event handler procedure shell to the code window. See Syntax for Microsoft Outlook property and control values and events for details on the key events that fire when the user interacts with the data controls on the form.
Code runs only on properly published custom forms, not on .oft form templates or one-off forms. See Microsoft Outlook Forms Security Issues for information on other specific scenarios that can result in code not running.
Forms with code behind them do not normally show any content in the reading pane. Instead, the user must open the item to see the content. This behavior is controlled by a hidden MAPI property. For a code example that shows how to add the property and set its value using CDO 1.21, see Active content in preview pane - solved. Redemption could also be used, instead of CDO. We haven't tried the technique with the PropertyAccessor object in Outlook 2007.
Using formulas for initial values and validation
Set the icons for a custom form on the (Properties) page. Icons need to be 32x32, 16-color files. For the small icon, the image should be in the upper-left corner.
Quirks, limitations, samples, etc. of particular Outlook forms:
Publishing and sharing forms
Managing published forms
To delete a published form, you can use the Forms Manager. Choose Tools | Options | Other | Advanced Options | Custom Forms | Manage Forms. For code solutions, see:
To get a list of all the published forms in a folder, see:
Other custom form issues
In .NET, you can embed your Windows Forms into Outlook 2013 - 2000 windows using the Advanced form and view regions feature provided by Add-in Express. For more informations, see:
- Video: Build and control advanced regions for Outlook 2013 – 2000 -- end-to-end demo
- Add-in Express Regions for Outlook and VSTO -- an extension of Visual Studio Tools for Office 2008, 2010 and 2012
Newsgroup on the msnews.microsoft.com server, also available via web interface
Installs an Outlook form into multiple folders.
To open a published form in design mode without the form's VBScript running, hold down the Shift key as the form opens.
If you delete a published custom form accidentally, you may be able to recover it from the forms cache. Follow the instructions in the MSKB article Restoring an Outlook form from a cached copy, only open the saved .oft file by using the Tools | Forms | Choose Form or Design a Form command, rather than double-clicking the .oft file.
Examining existing forms is one of the best ways to find out what you can do with Outlook forms. Many sample Outlook forms are available at these sites: