I am working with the Exchange Web Services Managed API and am having an issue with getting a contacts photo. I am using FindItemsResult object to retrieve a collection of items with the following code:
Dim contactsFolder As ContactsFolder = contactsFolder.Bind(EWS.EWService, parentFolder.FolderId, New PropertySet(BasePropertySet.IdOnly, FolderSchema.TotalCount)) Dim numItems As Integer = contactsFolder.TotalCount 'Get all existing contacts in folder Dim view As ItemView = New ItemView(numItems) view.PropertySet = New PropertySet(BasePropertySet.FirstClassProperties, ContactSchema.Photo) Dim contacts As FindItemsResults(Of Item) = EWS.EWService.FindItems(parentFolder.FolderId, view) For Each i As Item In contacts If TypeOf i Is Contact Then Dim p As Byte() = DirectCast(i, Contact).DirectoryPhoto End If Next
The contact item always returns nothing for the DirectoryPhoto property even though the contact in exchange has a photo and the contact "HasPicture" property is true.
Any ideas or examples of reading a contacts photo would be appreciated.