ValueError: 'id' mismatch in returned update response #1241
-
In the code snippet below I am updating fields of a contact with the display name = "Test Contact". I get the following, 'ValueError: 'id' mismatch in returned update response' error. The error occurs when I contact.save(). However, the fields for the contact are still updated in Outlook despite the error. Any ideas how to bypass this error?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
In Exchange, all items have an ID and a ChangeKey value. When you update an item, the ID is supposed to stay the same, and the ChangeKey is supposed to change. On update, the server will return the ID and the ChangeKey of the newly updated item. In this case, it looks like the server also returns a new ID for the updated item. You can confirm whether this is the case if you enable debug logging and capture the request and response XML documents. If the server indeed returns a new ID on update, then we'll just have to relax this |
Beta Was this translation helpful? Give feedback.
-
If anyone has this issue, the fix is simple. Locate items.py. In the save function, comment the following line:
Also, adjust the indentation of this line to be inside the if self.id conditional:
Resulting in the following save function:
|
Beta Was this translation helpful? Give feedback.
If anyone has this issue, the fix is simple. Locate items.py. In the save function, comment the following line:
#raise ValueError("'id' mismatch in returned update response")
Also, adjust the indentation of this line to be inside the if self.id conditional:
self._id = self.ID_ELEMENT_CLS(item_id, changekey)
Resulting in the following save function: