Search code examples
exchange-serverexchangewebservices

Exchange Web Services - sending email error "item is out of date"


I have code which sends email via EWS (it has to read incoming email and move messages, so sending via EWS instead of SMTP makes some sense). 95% of the time it works, but occasionally I get an error saying: "The operation can't be performed because the item is out of date. Reload the item and try again."

I already am saving the email in the Sent Items folder and then calling Bind() to reload the message before trying to send. Any insights into what is going on and why? Also, how to avoid or recover since Bind() isn't reloading the message?


Solution

  • I already am saving the email in the Sent Items folder and then calling Bind() to reload the message before trying to send

    Why are you saving it to the Sentitems folder before sending? its better to use drafts folder as a number of different things maybe syncing against the other folders (including the substrate processes in Office365). It sounds like the changekey is out of date probably because another process has made a changed to the Sent Message.