stan
stan

Reputation: 4995

syncFolderHierarchy result differs between Exchange versions(configurations?)

Preface: Crosspost from Microsoft's forum: http://social.msdn.microsoft.com/Forums/office/en-US/47d1167b-24d0-43ed-b28b-21d8d82570a1/syncfolderhierarchy-differs-between-exchange-versions?forum=exchangesvrdevelopment

I've been testing EWS's syncFolderHierarchymethod to sync changes from exchange. My development testing has all been done with one Exchange 2013 version. I've noticed this behavior:

Calling syncFolderHierarchy for folder X changes the sync state when there has been a change to the folder structure under X.

Calling syncFolderHierarchy for folder X changes the sync state when a message has been added/removed from a subfolder* under X.

However after doing more testing with Exchange 2010, I found a troubling issue where folder structure changes change the sync state, but not changes to the folder itself.

So for 2010(the one I have setup): Calling syncFolderHierarchy for folder X does not change the sync state when a message has been added/removed from a subfolder* under X.

This is a big issue because while testing with 2013 I was under the impression that syncFolderHierarchy would change the sync state if messages would be moved around. If that happened, I then called syncFolderItems on each folder to find where the change came from. If I cannot know if there have been any item changes just by calling syncFolderHierarchy, then I would have to go through each folder each time just to check if there have been any changes. That sounds horrible and will cripple my application.

So finally my question! Yay

Is there a configuration/setup issue with 2010 that's not behaving like 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 behave nicely like 2013, what's the best approach to sync without going through all the folders?

*By subfolder, I don't mean added/removed from X directly, but from a subfolder of X, say X/Y/Z. Moved message from Z to Y.

Edit: It would be helpful to know the actual correct behavior of syncFolderHierarchy. Is the behavior correct on the "2010" or the "2013" scenario that I described?

Upvotes: 2

Views: 225

Answers (1)

Mimi Gentz
Mimi Gentz

Reputation: 1658

I can't speak to the different sync states you're getting with Exchange 2010 and Exchange 2013, but one workaround would be to use notifications to trigger your sync calls. So if you subscribe to NewMailEvents, for example, the notification will identify the ParentFolderId, and then you can sync just the items in that folder. There's more about notification-based synchronization in these two topics: Notification subscriptions, mailbox events, and EWS in Exchange and Mailbox synchronization and EWS in Exchange.

Upvotes: 0

Related Questions