exchange-serverexchangewebservicesexchange-server-2007

How to get ItemId or AttachmentId (photo) of a contact from Active Directory? Exchange web services 2007


I have a task to get user's photo of a contact in outlook. We use EWS soap API for exchange 2007 version.

I discovered how to get the photo if I know the contact's ItemId (call GetItem, then GetAttachment). But when I use ResolveNames operation with Active Directory search scope it gives me some info, bot there are no neither data related to photo (AttachmentId), neither ItemId of a contact. I think thats because I use Active Directory scope since if I use account's Contacts as search scope then ItemId is shown properly. Maybe only items from account's Contacts list has an Id (my guess). But anyway, I must use Active Directory scope to search across all contacts of a company. I dont know any other way to get Contact info from Active Directory other than Resolve Names.

So basically I need to find a way to get Contact from Active Directory either with ItemId (to use it in GetItem operation) or with attachment's AttachmentId (to use in GetAttachment operation to get image file).


Solution

  • Contacts stored in the mailbox have nothing to do with the GAL objects. Contacts use items as their storage - they are essentially messages with a different message class (IPM.Contact vs IPM.Mpte).

    GAL objects don't store pictures as separate attachments, they are just binary properties not any different from other properties (such as display name string property).