myItem.Id,这是跨系统唯一的吗

myItem.Id, is this unique across systems

我正在使用 this link 中的一段 C# 代码通过 EWS API 2.0 访问我的 Exchange 2010 服务器。现在我们正在将邮箱以及收件箱和子文件夹中的所有电子邮件迁移到云端。

我的问题是什么时候每封电子邮件的 myItem.Id 值仍然保持不变? Exchange 管理员说它将在所有 Exchange 服务器中是唯一的。但我到目前为止所做的测试没有发现任何证据。这些电子邮件被输入数据库,当邮箱迁移到云端时,处理这些电子邮件的应用程序会将它们视为新电子邮件,因为 myItem.Id 由于迁移而在两个系统中不是唯一的。

My question is when that happens will the myItem.Id value still remain the same for each and every email?

不,不会,如果邮件只是在文件夹之间移动,则 ID 会发生变化。 EWSid 基于底层 Exchange LongTermId https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcdata/8796d8f9-0052-4a5a-ab8e-e780b9c8a6bb. So it contains both FolderId and MessageId information (there is a global counter value involved) and some EWS specific flags . Its essentially a locator so it needs to be globally unique but in Office365 the underlying Store information changes (which affects the FolderId part of this id) so the ewsId will also change. Office365 offers immutableid's https://docs.microsoft.com/en-us/graph/outlook-immutable-id 但您需要使用图表 API 他们没有将它们移植到 EWS。

对于您的迁移,您可能需要考虑在项目上创建自己的自定义 属性,这样您在迁移后仍然可以使用搜索(或使用现有的 属性,如 InternetMessageId 或 PidtagSearchkey 找到它们)