Unable to Send Email Messages using Microsoft.Exchange.WebServices Library

Ihor Kuliiev 156 Reputation points
2024-05-22T19:05:03.85+00:00

Hello!

I've been using Microsoft.Exchange.WebServices 2.2.0 library to send emails from my C# application for a couple of years and have not been changed my code for a long time.

It worked seamlessly but yesterday I started constantly getting the following exception on Microsoft.Exchange.WebServices.Data.EmailMessage.Send() method call:

"Microsoft.Exchange.WebServices.Data.ServiceResponseException: The operation can't be performed because the item is out of date. Reload the item and try again."

Could you please advise why this may happen and what possible ways are to resolve this?

Thank you in advance!

Exchange Server
Exchange Server
A family of Microsoft client/server messaging and collaboration software.
1,337 questions
Exchange Server Development
Exchange Server Development
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Development: The process of researching, productizing, and refining new or existing technologies.
547 questions
{count} votes

3 answers

Sort by: Most helpful
  1. David Barrett 21 Reputation points Microsoft Employee
    2024-05-29T10:41:26.7366667+00:00

    The error message is telling you what the issue is - the item that you have a copy of has been updated on the server in the meantime, so your copy is stale and needs to be reloaded. You'll get this error if the ChangeKey you send in your request does not match the ChangeKey of the item on the server.

    This is something that needs to be handled by the client (by reloading the message, or simply retrying the request with the up-to-date ChangeKey).

    2 people found this answer helpful.

  2. Richard Procter 5 Reputation points
    2024-05-24T14:19:54.4533333+00:00

    Exact same problem here, a solution that is many years old began failing intermittently on 23 May. Messages sent without an attachment always work fine, but those with attachments fail 50% of the time with this message.

    Another forum has suggested a possible workaround of updating code to first save the message in drafts folder, then retrieve and send from drafts. We are going to try that next.

    1 person found this answer helpful.

  3. Rob F 0 Reputation points
    2024-05-23T10:16:34.8766667+00:00

    We are seeing the same issue - since this morning. Before today it has worked seamlessly for us for years.

    In our case, we save the message to the 'Drafts' folder, so that we can get an InternetMessageId and retrieve the MIME content of the message before sending.

    // if we need to load extra content
    if (loadContent)
    {      
    	// save email to drafts
    	message.Save();
    	// load the mime content of the email
    	message.Load(new PropertySet(ItemSchema.MimeContent, EmailMessageSchema.InternetMessageId));
    }                  
    // send the email, and move it to SentItems                 
    message.SendAndSaveCopy(); 
    

    If we skip that step, the messages appear to send.

    This does not fix the problem for us, we do need the MIME content.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.