Here's a snippet of my code:
ExchangeSyncFolderItemsResult result = new ExchangeSyncFolderItemsResult(); bool syncAgain = true; int actualChangeCount = 0; while (syncAgain) { PropertySet props = new PropertySet(PropertySet.FirstClassProperties); props.Add(EmailMessageSchema.InternetMessageId); ChangeCollection<ItemChange> icc = exchange.SyncFolderItems(folderId,PropertySet.FirstClassProperties, null, 512, SyncFolderItemsScope.NormalItems, result.getSyncState()); foreach (ItemChange ic in icc) { // etc. } // etc. result.setSyncState(icc.SyncState); }
In one particular folder in one particular user's mailbox, I'm getting an exception:
This property was requested, but it wasn't returned by the server.
2014-02-10 14:11:52.1648|FATAL|DSFCMSEprocess01| at Microsoft.Exchange.WebServices.Data.PropertyBag.get_Item(PropertyDefinition propertyDefinition)
at Microsoft.Exchange.WebServices.Data.Item.get_DateTimeSent()
My question is how do I deal with this? Since an exception is thrown, I don't have a valid icc.SyncState returned. Without that, I can't update my saved SyncState for the next call within the same folder, which means that as long as that item remains in the folder I'm going to get the same error every time. I also don't get an ItemId back for the item that caused the exception, so I can't build an IEnumerable<ItemId> to pass as the ignoredItemIds. So how do I get past this?
BTW: I do not have access to the mailbox where this problem is occurring, and as of now it is unlikely that I will get access, so I don't know anything about the particular item that caused this exception. Any advice as to how to get that info would also be appreciated.
-rhs