【发布时间】:2021-06-11 18:48:11
【问题描述】:
假设您正在构建一个从 EWS 同步消息正文和元数据的应用程序。让您的初始状态同步非常简单:致电 SyncFolderHierarchy to get the folder list, SyncFolderItems to get the message ItemIds, and GetItem to get the message bodies and metadata.
当试图通过移动跟踪消息时,事情变得有点复杂。移动后,对SyncFolderItems 的调用将在一个文件夹中返回创建,在另一个文件夹中返回删除。您希望将这些关联起来,以便客户端可以避免重新下载邮件正文和附件。 (另外,这样客户端就不会丢失与其本地副本关联的任何元数据。)但是,在文件夹之间移动消息会更改其 EWS ItemId,因此 ItemId 不能用于关联创建和删除。
EWS 文档建议 subscribing to streaming notifications,它确实支持移动事件。但是流式通知aren't buffered when the stream is not connected,因此在建立流式连接之前,您仍然必须使客户端恢复同步。因此,流式通知不能成为完整的关联移动解决方案。
另一个 EWS 选项是 subscribing to pull notifications。与流式通知一样,拉取通知也支持移动事件。与流式通知不同,拉订阅缓冲更改。但是,如果您的客户端在拉取订阅到期时处于脱机状态,那么您又会回到同样的情况。 (不过,由于a pull subscription can be scoped to last a full day,这可能仍然可行。)
最后一个选项是使用 ItemId 以外的东西来关联通过 SyncFolderItems 移动的项目:
PR_SEARCH_KEY通过移动工作,但在副本方面存在问题(因为副本最终与原始的PR_SEARCH_KEY相同)PR_ENTRYID好像是like it'd be workable for this purpose 又好像是better thanPR_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 通过移动关联项目的正确方法是什么?
【问题讨论】:
标签: office365 exchangewebservices