More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

Understanding Custom Fields in Microsoft Outlook

Developers accustomed to relational databases often have problems working with custom Outlook fields, because Outlook is a "semi-structured" database. Outlook does not require you to define the data structure of a folder before you add data, though you can certainly approach it that way. Outlook also allows you to mix items with different data structures in the same folder. While this allows very rich, flexible data handling, it can be a nightmare when you try to create folder views or use methods like Items.Restrict and Items.Find that require fields to be predefined in the folder.

This article proposes a "best practice"  for creating custom fields for use in Outlook forms to ensure that the fields also exist in the folder where the form will be used. 

We also discuss what to do when you want to use a custom form in a folder that does not already contain the custom fields.

Best Practice

This method is quick and especially good for Yes/No fields and for fields you want to display in a text box. It is also dependable if you have already begun working on your form design and need to add more fields:

  1. Switch to the folder where your form will be deployed.
  2. Create the custom fields in the folder. You can use View | Current View | Customize Current View | Fields. Or, in a table view, right-click the column headings and choose Field Chooser.
  3. On the form in design mode, drag the fields from the Field Chooser to the customized form pages.

This creates a check box control on the form for Yes/No fields and a text box for other properties, adding the properties to the form (and thus to any items created with the form).

Note that you should not use the Field Chooser that appears with the form in design mode to create the new fields.

Alternate Method When You're Building a Form from Scratch

If you are starting a new form design from scratch, you can use this method to create fields in the folder and in the form at the same time:

  1. Create a new item in the target folder, either by clicking the New button or choosing File | New | Post in This Folder.
  2. Choose Tools | Forms | Design This Form to put the item into form design mode.
  3. Click the toolbox button to display the control toolbox.
  4. Add the desired control to the form.
  5. Right-click the control, choose Properties, then switch to the Value tab. 
  6. Click New to create the new field.

Note that this method does not work with message forms, because the parent folder of a new message is the Outbox.

Notes

A custom form does not need to display all of its the custom properties on custom form pages. In general, a custom form displays only those properties that users should be able to read or change. You may have other properties on hidden custom pages or listed only in the All Fields page. These properties can still be used by the code behind the form, even though they are not visible to the user.

To remove a custom property from an item along with the data stored in that property, delete that property from the item's UserProperties collection.

More Information