Search code examples
c#.net-3.5exchangewebservicesexchange-server-2010

Will calling `SyncFolderItems` return items as they get received?


Does calling SyncFolderItems in a loop (until MoreChangesAvailable is false) return items that have been received after my first call to SyncFolderItems?

For example, say I have 1,000 items in my mailbox and I make a call to SyncFolderItems with no sync state. After my first call to SyncFolderItems I receive an item will it include a new email I receive after I first call SyncFolderItems?


Solution

  • Each call to SyncFolderItems will respond with SyncState which is a hash of the timestamp and item index (if > 512 items) since the last synchronization call. When you call the SyncFolderItems again, you need to include the last SyncState to ensure you only get new items since your last synchronization point.

    If you have more than 512 items in the folder - you need to call SyncFolderItems again with the new SyncState.

    Here is a sample post using EWS Managed API.