Outlook Tips--Displaying Linked Contact Fields

Use this code to display contact information on a custom form.

Sue Mosher

November 4, 2001

1 Min Read
ITPro Today logo in a gray background | ITPro Today


How can I display some standard contact fields—such as the Account property for the contact that I've linked to the appointment—in the Appointments view of my Calendar folder?

Folder views show only the data that resides in the current folder. Detailed information about a linked contact is in the Contacts folder, not the Calendar folder. One way to see this information in the Calendar folder is to use a custom appointment form that pulls the data from a linked contact into custom fields on the appointment form.

In design mode, on the All Fields page, click New and create a text field named ContactAccount. This action also creates the field in the Calendar folder so that you can add it to a view later. (You can't add the field to a day/week/month view, however; you need to use a table view instead.)

Next, add the code that Listing 1 shows to the form's code. The Item_ Write event will fire whenever you save an item that uses this form. The Links property of an Outlook item is a collection of related contacts, those that the user lists in the Contacts box at the bottom of the appointment form's first page. Each resolved (i.e., underlined in the UI) Link in the Links collection has an Item property that corresponds to the contact. The code in Listing 1 retrieves the related ContactItem and copies its Account information into the Contact Account property on the appointment. Note that the code in Listing 1 handles only the first Link in the Links collection.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like