SyncFolderHierarchy result differs from Exchange versions (config?)
Foreword: Crosspost from Microsoft Forum: http://social.msdn.microsoft.com/Forums/office/en-US/47d1167b-24d0-43ed-b28b-21d8d82570a1/syncfolderhierarchy-differs-between-exchange-versions?forum=exchangesvrdevelopment
I have tested the EWS method
for syncing changes with exchange. My development testing was done with one version of Exchange 2013. I noticed this behavior:
Calling syncFolderHierarchy on folder X changes the sync state when the folder structure in X changes.
The syncFolderHierarchy call on folder X changes the sync state when a message was added / removed from the * subfolder under X.
However, after doing more testing with Exchange 2010, I discovered an alarming issue in which changes to the folder structure change the sync state but not change in the folder itself.
So in 2010 (the one I have installed): calling syncFolderHierarchy on folder X does not change the sync state when a message was added / removed from subfolder * under X.
This is a big problem because during testing since 2013, I got the impression that syncFolderHierarchy will change the sync state if messages are moved. If this happened, I then called syncFolderItems in each folder to find where the change came from. If I can't know if there were any changes to the items, just by calling syncFolderHierarchy, I would have to go through each folder every time to check if there were any changes. This sounds terrible and will cripple my application.
So finally my question! Yay
Is there a configuration / setting issue in 2010 that doesn't work in 2013 in this case? Is there a default behavior that needs to be changed?
Finally, if there is absolutely nothing I can do to make the 2010 version look as good as 2013, what's the best approach to syncing without going through all the folders?
* In subfolder, I do not mean adding / removing from X directly, but from subfolder X, say X / Y / Z. Moved message from Z to Y.
Edit: It would be helpful to know the correct behavior of syncFolderHierarchy. Is the behavior correct in the "2010" or "2013" scenario I described?
source to share
I can't talk about the different sync states you get with Exchange 2010 and Exchange 2013, but one way would be to use notifications to trigger your sync calls. For example, if you subscribe to NewMailEvents, the notification identifies the ParentFolderId, and then you can only sync items in that folder. More information about notification-based synchronization in these two topics is more: Notification subscription, mailbox and EWS events in Exchange, and Mailbox and EWS synchronization in Exchange .
source to share