Correlation of messages through moves through EWS

Suppose you are creating an application that synchronizes message bodies and metadata with EWS. Getting a synchronized initial state is pretty simple: call to get a list of folders , to get an ItemIds message and to get message bodies and metadata. SyncFolderHierarchySyncFolderItemsGetItem

When you try to track messages through moves, it gets a little harder. After the transition, the calls SyncFolderItemswill return Create in one folder and Delete in another. You want to adjust them so that the client can avoid reloading the message body and attachments. (Also, so that the client does not lose any metadata associated with its local copy.) However, moving a message between folders changes its EWS ItemId, so ItemId cannot be used to correlate Create and Delete.

The EWS documentation offers streaming notification subscriptions that truly support Move events. But streaming notifications are not buffered when the stream is not connected , so you still need to return the client to synchronization before establishing a streaming connection. Thus, streaming notifications may not be a complete solution for correlating between movements.

Another option for EWS is to subscribe to pull notifications . Like streaming notifications, support for carry notifications notifies Move events. And unlike streaming notifications, pull out the subscription buffer changes. But if your client is disconnected when the push subscription expires, you are in the same situation again. (However, since pulling out a subscription can be limited to a full day , it can still be workable.)

The last option uses something other than ItemId to correlate the moved items with SyncFolderItems:

  • PR_SEARCH_KEYworks through moves, but has problems with copies (since the copy ends with the same PR_SEARCH_KEYas the original)

  • PR_ENTRYID , PR_RECORD_KEY:

A MAPI store provider assigns a unique ID string when an item is created in its store. Therefore, the EntryID property is not set for a Microsoft Outlook item until it is saved or sent. The EntryID changes when an item is moved into another store, for example, from your Inbox to a Microsoft Exchange Server public folder, or from one Personal Folders (.pst) file to another .pst file. Solutions should not depend on the EntryID property to be unique unless items will not be moved. The EntryID property returns a MAPI long-term EntryID.

... EWS?

+4

Source: https://habr.com/ru/post/1619580/


All Articles