I started with the Exchange 2007 code samples from MSDN, for retrieving
messages from Exchange via web services.
Even though I specify "itemProperties.BaseShape =
DefaultShapeNamesType.AllProperties;" many of the fields in each message
(email addresses, body, etc.) are null.
I am trying to use "itemProperties.AdditionalProperties" to include the
message Body, but it is causing an error.
Where do I go from here?
Thanks,
Eric
ExchangeServiceBinding NewESB = CreateESB();
FindItemType findItemRequest = new FindItemType();
findItemRequest.Traversal = ItemQueryTraversalType.Shallow;
ItemResponseShapeType itemProperties = new ItemResponseShapeType();
//*******Even though I specify AllProperties, not all of the properties are
itemProperties.BaseShape = DefaultShapeNamesType.AllProperties;
itemProperties.BodyType = BodyTypeResponseType.Text;
PathToUnindexedFieldType TheBody = new PathToUnindexedFieldType();
//***********THIS FOLLOWING LINE IS CAUSING THE PROBLEM?
TheBody.FieldURI = UnindexedFieldURIType.itemBody;
//***********ErrorMessage from EWS is "Property is not valid for this
operation" for the Element "t:FieldURI"
itemProperties.AdditionalProperties = new BasePathToElementType[1];
itemProperties.AdditionalProperties[0] = TheBody;
findItemRequest.ItemShape = itemProperties;
DistinguishedFolderIdType[] TypeArray = new DistinguishedFolderIdType[1];
TypeArray[0] = new DistinguishedFolderIdType();
TypeArray[0].Id = DistinguishedFolderIdNameType.inbox;
findItemRequest.ParentFolderIds = TypeArray;
FindItemResponseType findItemResponse = NewESB.FindItem(findItemRequest);
ArrayOfResponseMessagesType responses = findItemResponse.ResponseMessages;
Archived from group: microsoft>public>exchange>development