How to: Get the E-mail Address of a Contact Item
How to: Get the E-mail Address of a Contact Item |
This topic shows how to obtain the value of a named property that represents the e-mail address of an Outlook Contact item.
You can associate up to three e-mail addresses with a Contact item in Outlook. Each e-mail address corresponds to a property of the Outlook ContactItem object in the Outlook object model. Internal to Outlook, the e-mail address also corresponds to a MAPI named property. For example, the first e-mail address of a contact corresponds to the Email1Address property of the ContactItem in the Outlook object model, and the Outlook internal named property dispidEmailEmailAddress.
To obtain the value of an e-mail address of a contact item, you can use the PropertyAccessor object of the Outlook object model, or first use IMAPIProp::GetIDsFromNames to obtain the property tag of the named property, and then specify this property tag in IMAPIProp::GetProps to get the value. When calling IMAPIProp::GetIDsFromNames, specify the appropriate values for the MAPINAMEID structure pointed at by the input parameter lppPropNames. The following code sample shows how to obtain the first e-mail address of a specified contact, lpContact
, using GetIDsFromNames and GetProps.
|