Exchange Web 服务:为什么 ItemId 不恒定?

发布于 2024-10-01 13:54:47 字数 225 浏览 0 评论 0原文

我编写了一个小型应用程序,它应该自动处理公共文件夹中的电子邮件。对于每封电子邮件,我们希望在数据库中保存一些元数据。

我想使用 ItemID 来建立此元数据和特定电子邮件之间的链接,但我刚刚发现此 ItemId 不是恒定的。例如,如果电子邮件从公共文件夹移动到另一个文件夹,它将收到另一个 ItemId。这意味着电子邮件和相关元数据之间的链接丢失。

那么,问题是,如何在元数据和特定电子邮件之间建立链接?

I write a small application, which should automatically process the emails from a public folder. For each email, we want to save some metadata, in a database.

I wanted to use the ItemID to make the link between this metadata and a specific email, and I have just discovered that this ItemId is not constant. For example, if the email is moved from a public folder to another, it will receive another ItemId. That means, that the link between the email and the associated metadata is lost.

So, the problem is, how can I make the link between the metadata and the specific email?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

红ご颜醉 2024-10-08 13:54:47

我的理解是,EWS 唯一 ID 包含某种形式的 EntryId。因此,一旦元素移动到另一个文件夹,它就会发生变化。

虽然此处不适用,但日历条目的情况更为复杂,因为 Exchange 在某些情况下会销毁并重新创建约会,从而更改唯一 ID。

此页面(http://msdn.microsoft.com/en-us/library/cc815908.aspx) 包含可用于识别对象的 MAPI 属性的概述。另一种方法是您可以将自己的 id 属性添加到 Exchange 元素(通过扩展属性)。

My understanding is, that the EWS unique id contains the EntryId in some form. Therefore, it will change once the element is moved to another folder.

And while not applicable here, the situation is more complicated with calendar entries, as Exchange destroys and recreates an appointment under certain circumstances, thereby changing the unique id.

This page (http://msdn.microsoft.com/en-us/library/cc815908.aspx) contains an overview over MAPI properties which can be used to identify an object. An alternative to this is that you can add your own id property to the Exchange element (via extended property).

温柔戏命师 2024-10-08 13:54:47

项目 ID 更改。它并不自始至终保持独特。
为了访问一项,可以使用 GUID。

(下面的 SOAP 请求用于获取日历项目。)
您可以在 FindItem 调用中使用 GUID 获取有关项目的信息

 <FindItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" 
      xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" 
     Traversal="Shallow">
  <ItemShape>
  <t:BaseShape>AllProperties</t:BaseShape>
  </ItemShape>
  <Restriction>
  <t:IsEqualTo>
  <t:ExtendedFieldURI PropertySetId="6ED8DA90-450B-101B-98DA-00AA003F1305" PropertyId="3" PropertyType="Binary" /> 
  <t:FieldURIOrConstant>
  <t:Constant Value="BAAAAJXIl1MJ8="/>  /* GUID */ 
  </t:FieldURIOrConstant>
  </t:IsEqualTo>
  </Restriction>
  <ParentFolderIds>
  <t:DistinguishedFolderId Id="calendar"/>
  </ParentFolderIds>
  </FindItem>

Item ID Changes. It doesn't remain unique throughout.
For accessing an item, one can use GUID.

(The SOAP Request below is for fetching a calendar item.)
You can fetch information about an item using GUID in a FindItem call

 <FindItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" 
      xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" 
     Traversal="Shallow">
  <ItemShape>
  <t:BaseShape>AllProperties</t:BaseShape>
  </ItemShape>
  <Restriction>
  <t:IsEqualTo>
  <t:ExtendedFieldURI PropertySetId="6ED8DA90-450B-101B-98DA-00AA003F1305" PropertyId="3" PropertyType="Binary" /> 
  <t:FieldURIOrConstant>
  <t:Constant Value="BAAAAJXIl1MJ8="/>  /* GUID */ 
  </t:FieldURIOrConstant>
  </t:IsEqualTo>
  </Restriction>
  <ParentFolderIds>
  <t:DistinguishedFolderId Id="calendar"/>
  </ParentFolderIds>
  </FindItem>
淡淡の花香 2024-10-08 13:54:47

您必须将 EntryItemId 转换为 EWS 唯一项目 ID,然后您可以用作主键来创建数据库条目

看看:

链接

you have to convert the EntryItemId to EWS unique item id then you can use as primary key to create an entry into the DB

Have a look at:

Link

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文