Article ID: 183352 - Last Review: January 22, 2007 - Revision: 1.2 OL97: Working With User-defined Fields in SolutionsThis article was previously published under Q183352 On This PageSUMMARY
Unlike most other database-related software packages, Microsoft Outlook 97
can store different sets of user-defined fields in different items in a
folder. While this means that items in a folder are very flexible
"containers" for storing data, it also means that developers need to be
aware of how this flexibility may impact an Outlook-based solution. This
article discusses considerations solution developers should take into
account when planning, implementing, and deploying, a solution using
Outlook custom forms and user-defined fields.
This article contains the following topics:
MORE INFORMATIONOverview of Outlook Standard and User-Defined FieldsIn a database program such as Microsoft Access, fields are defined at the "table level," meaning that once you add a field to a table of data, the field will exist in all records in the table. Outlook items are like records in a database, and Outlook folders are conceptually equivalent to a table or flat-file database. But this database analogy breaks down when you consider how Outlook and Microsoft Exchange implement the concept of fields, or properties.In Microsoft Exchange, items in a folder can have any set of fields. It is up to the application to determine the "field schema" for items in a folder. Outlook has separate field schemas for each of the different pre- defined items such as Contacts, Appointments, Tasks, and such. Each of these items has a set of standard fields specific to that type of item. Note that some fields exist in more than one type of item, like the Start field in appointments and journal entries, and some fields exist in all items, like Mileage and Billing Information. In addition to the standard fields that Outlook makes available for each type of item, Outlook allows you to create user-defined, or custom fields to store additional information with an item. While these user-defined fields serve the same purpose as the standard fields, you typically use them in a different manner. The most important difference between standard fields and user-defined fields is that standard fields are always available when working with a particular type of item, but this is not necessarily true when working with user-defined fields. User-defined fields can exist in:
Adding User-Defined FieldsWhen you use the Field Chooser to create a field, either while in a view or while in design mode of a form, the field will be added to the folder. If you are in form design mode and then drag the field onto the form, the field will then be added to item and Outlook will automatically create a control and bind the field to the control.If you are in form design mode and right-click a control to access its properties, you can create a new user-defined field by clicking the New button on the Value tab of the Properties dialog box. Creating a field in this manner will result in the new field being added to both the item and the folder. Fields can also be introduced into a folder solution by copying or moving an item from another folder into the solution's folder. Or, they can also be introduced if you programmatically create fields on-the-fly or as part of a solution to import items into a folder. It is important to keep in mind that there are scenarios that can cause user-defined fields to not exist in one or more of the three locations, and this can adversely affect a solution. The follow table summarizes Outlook behavior when creating new user-defined fields: Action: Field added to: ------------------------------------------------------------------- Using New button on Field Chooser in a view. Folder New button on Field Chooser in form design mode. Folder Dragging field from Field Chooser to form. Item Using New button in the Properties dialog box Item & folder of a Control when binding the control to a field. Deleting User-Defined FieldsUse the following table to determine how to delete a field that exists in the following locations:
To Delete
Field From: Do This:
------------------------
Folder Use the Field Chooser and set the list to show "All
user-defined fields in <folder name>."
Item Use the All Fields tab of the item.
Form Create a new item based on the existing custom form,
delete the field using the All Fields tab of the form,
and republish the form.
Determining Where Fields ExistUse the following table to determine where a field exists:
To Verify Fields
are in the: Do This:
--------------------------
Folder Use the Field Chooser and set the list to show "All
user-defined fields in <folder name>"
Item Use the All Fields tab of the item and set the list
to show "All user-defined fields in item." Note that
you may want to temporarily display this page of the
form while you are developing the solution.
Form Create a new item based on the existing custom form
and then check the All Fields page of the form as
above.
What Can Go Wrong?Here are some of the symptoms you can experience when user-defined fields are not consistent in a folder-based solution:
General Suggestions
If you create items for testing your solution as you develop it, you should delete these items and create new ones if you add user-defined fields into the form. If you must add fields into a folder solution after having already created items, consider making sure all of the items get the new fields added to them. You can do this either programmatically, (Item.UserProperties.Add) or by displaying the items in a table view, adding the user-defined field to the view, temporarily adding a value into the field so that Outlook adds the field into the item on-the-fly, and then deleting the temporary values.
For more information about programmatically adding fields to an item, please see the following article in the Microsoft Knowledge Base: 170320
(http://support.microsoft.com/kb/170320/EN-US/
)
OL97: How to Programmatically Import Outlook Items
from Access
Programming Considerations
Example SolutionMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:https://partner.microsoft.com/global/30000104
(https://partner.microsoft.com/global/30000104)
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:
http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS
(http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms)
The following is a lengthy series of steps that creates a sample folder-
based solution. The scenario is that you work at a veterinary hospital and
want to keep track of customers and the pets they have. To do this, create
a new Customers folder under your existing, default Contacts folder.
Create a Folder for the Contacts
Create and Publish a Simple Custom Contact FormThe initial form will keep track of the customer's pet names and types.
Because there are no existing items in the folder, since we just created it, we now have the fields existing in the folder and in the form. Since all new items will be based on the published form, all items will also have the two user-defined fields. This is an ideal scenario, since the user- defined fields will now exist in every possible location when working in this folder. Set the View for the FolderThe following steps will set up a table view and adds some fields to the view so that it's easier to monitor Outlook field behavior.
Create Two Contact Items for Customers
Add an Additional Field to the Published FormAdd an additional field to track whether or not each pet has been neutered.
Note that in the view the two items do not have a box next to them. This indicates that the fields are not actually in the item but are coming from the published form. This visual discrepancy may make it appear as though the fields are not part of the item and while technically they are not, for practical purposes they are available. Add an Additional Field to the FolderNow you will decide to add an additional field for the neutering date, but not use the published form to do so.
Create a Third Contact Item
NOTE: The item can be relinked to the published form by programmatically changing the Message Class back to IPM.Contact.Customer, but the size of the item will not be reduced. For more information about the Message Class field and how to change it, please see the following article in the Microsoft Knowledge Base: 170301
(http://support.microsoft.com/kb/170301/EN-US/
)
OL97: How to Update Existing Items to Use a New Custom Form
Now assume you wish to copy the contacts into a Microsoft Exchange public
folder to share them, but instead of making a copy of the folder you decide
to create a new folder and drag the contacts into it. In these steps we'll
use a standard folder instead of an actual public folder.
Create a new folder for the Contacts
Set up a Programming ExampleNow try to use the following VB or VBA automation code to retrieve those pet owners who have dogs. Make sure to reference the Outlook object library first.
The property "Pet Type" is unknown.
REFERENCES
For more information about creating solutions with Microsoft Outlook 97,
please see the following articles in the Microsoft Knowledge Base:
166368
(http://support.microsoft.com/kb/166368/EN-US/
)
OL97: How to Get Help Programming with Outlook
170783
(http://support.microsoft.com/kb/170783/EN-US/
)
OL97: Q&A: Questions about Customizing or
Programming Outlook
| Article Translations
|


Back to the top
