How to: Display Address Entry Details for the Sender of a Message
Outlook Developer Reference |
The recipient of each mail message deliverable by a transport provider has an address entry in the provider's hierarchy of address books for the session. This topic describes how to programmatically display the address entry information of the sender of a mail item that is currently displayed in an inspector.
- For the currently displayed mail item, use the PropertyAccessor object to determine the Entry ID of the sender.
- Use the NameSpace.GetAddressEntryFromID method of the current session to return an AddressEntry object.
- Use the AddressEntry.AddressEntryUserType property to determine the type of the AddressEntry, and then display the details accordingly:
- If the address entry is a contact item in the Outlook Contacts folder, or if the SMTP address of the sender matches an e-mail address of one contact item in the default Contacts folder, then display the address entry information in a Contacts inspector. To match e-mail addresses in the Contacts folder, use the Table object to do a quick filter on the ContactItem.Email1Address, ContactItem.Email2Address, and ContactItem.Email3Address properties of items in that folder.
- In all other cases, display the address entry information in the E-mail Properties dialog box.
Remarks
To run this code sample:
- Open a mail message to have it displayed in the active inspector.
- Place the code in the built-in ThisOutlookSession module.
- Run the
TestAddressEntryDetails
procedure to display address entry details on the mail message in the active inspector:
|
See Also