EWS UpdateItem 中的 ChangeKey 有何用途?
我正在尝试使用 Exchange Web 服务来更新日历项目。 我正在创建一个 ItemChangeType,然后创建一个 ItemIdType。 我有一个用于 ItemIdType.Id 的唯一 ID,但没有任何内容可用于 ChangeKey。 当我忽略它时,我得到一个 ErrorChangeKeyRequiredForWriteOperations。 但是当我尝试将一些东西放在那里时,我得到一个 ErrorInvalidChangeKey 。
我可以用什么来让它工作?
我还试图确定用于 ItemChangeType.Item 的 BaseItemIdType 的最佳实现是什么。 到目前为止,我正在使用 ItemIdType,我猜这是正确的,但我还没有找到任何关于此的特别有用的文档。
I'm trying to use Exchange Web Services to update a calendar item. I'm creating an ItemChangeType, and then an ItemIdType. I have a unique ID to use for ItemIdType.Id, but I have nothing to use for the ChangeKey. When I leave it out, I get an ErrorChangeKeyRequiredForWriteOperations. But when i try to just put something in there, I get an ErrorInvalidChangeKey.
What can I use for this to get it to work?
I'm also trying to determine what is the best implementation of BaseItemIdType to use for ItemChangeType.Item. So far, I'm using ItemIdType, and I'm guessing that's correct, but I haven't been able to find any particularly helpful documentation on this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我建议您使用 Exchange 托管 API(而不是 Exchange Web 服务)来处理 Exchange。 使用起来要容易得多。 您可以在下面找到更多详细信息:
https://msdn .microsoft.com/en-gb/library/dd877012(v=exchg.150).aspx
I recommend you to use the Exchange Managed API, instead of Exchange Web Services, for working with Exchange. It is much easier to use. You can find more details below:
https://msdn.microsoft.com/en-gb/library/dd877012(v=exchg.150).aspx
如果你只知道ID,你可以轻松获得ChangeKey,例如文件夹:
If you know ID only, you can get ChangeKey easily, for example for folder:
更明确地说明 Hauge 的答案:ChangeKey 存储在 Exchange 中并标识项目的当前状态。 对该项目的任何更改都会创建一个新的 ChangeKey。
这使得 Exchange 能够“知道”您的更新正在应用到与您查看该项目时相同的项目状态 - 自您检查以来它没有更改。
一些代码可在:
http://msdn.microsoft.com/en-us/library/aa563020.aspx
To be a bit more explicit on Hauge's answer: the ChangeKey is stored in Exchange and identifies the current state of the item. Any change to that item creates a new ChangeKey.
This allows Exchange to "know" that your update is being applied to the same item state as when you looked at the item - it hasn't changed since you checked it.
Some code available at:
http://msdn.microsoft.com/en-us/library/aa563020.aspx
如果您拥有 ItemIdType.Id 属性,您还应该可以访问 Changekey,它也是 ItemIdType 的属性:
ItemIdType.ChangeKey
与 Id 属性一样,它是一个字符串,因此您可以在抓取时抓取它身份证号。
问候
杰斯帕·豪格
If you have the ItemIdType.Id property you should also have access to the Changekey, it's also a property of ItemIdType:
ItemIdType.ChangeKey
Like the Id property it's a string, so you can grab it when you grab the Id.
Regards
Jesper Hauge