Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do I use for ChangeKey in EWS UpdateItem?

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.

like image 910
coder1 Avatar asked Dec 23 '22 14:12

coder1


1 Answers

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

like image 77
jeffreypriebe Avatar answered Dec 28 '22 06:12

jeffreypriebe