views:

82

answers:

1

I need to know how to get an e-mail address using MAPI. When I examine the contents of a MapiRecipDesc structure (returned, for instance, by a call to MAPIAddress()) I see that the lpszAddress field contains not a normal SMTP address, but what appears to be some sort of an Exchange server query:

EX:/o=MMS/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=laiic

I believe I could use this to pull additional information from Exchange via Active Directory... Does anyone know if I could obtain an external email address this way, and if so, how I might accomplish this?

+1  A: 

Its been a while since I've worked with MAPI, but in a nutshell:

This is an X500 address.

You should be able to lookup this address via LDAP (to the AD Server) using the LegacyExchangeDN attribute as the filter.

At that point you can pull the proxyAddresses attribute of the returned object and iterate through it looking for the address with a smtp: prefix ... the one with the all uppercase SMTP: is the primary email account for the object if more than one smtp: exist

Ruddy