Item out of date error when using EWS RRS feed

  • Question

  • I am trying to add contacts to my users' contacts folders via the EWS Managed API but when I try to add a significant number of contacts (usually over a hundred or so) to a user's folder I often come across the following error:

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

    When I re-run the process it seems to move on a few contacts and then fails again but if I leave it for a while or run it out of office hours it seems to work which makes me think that some other process is interrupting it.

    Has anyone else come across this error and found a solution to it?

    Monday, July 23, 2012 1:13 PM

All replies

  •  What does your code look like ? Are you batching the creates ?

     You say users so are doing this on multiple mailboxes is it possible that one of these mailboxes is being moved etc.


    Tuesday, July 24, 2012 6:09 AM
  • Hi Glen,

    There's no batching going on. I'm just using a for loop and for each user I'm creating the contacts on the service i.e. Contact contact = new Contact(service); Then I'm populating and calling Save().

    I added a Thread.Sleep(60000) and a retry upon error and that seemed to fix it but now, obviously, my app takes much longer to run.

    I know the mailboxes are not being moved. It seems like it's conflicting with something else that may get a lock on the folder or something. Any idea what the error actually means?


    Tuesday, July 24, 2012 3:45 PM
  • Sounds a bit strange without seeing a bit more of the code your using I can only guess.

    If your creating new Items the only thing that could be out of date would be the ChangeKey for the Folder (unless are you updating the Contacts once created eg uploading attachment etc).  Are you using the ChangeKey for the Folder when you save the appointment (you shouldn't need to use it).


    Wednesday, July 25, 2012 6:25 AM
  • Hi Glen,

    I'm looping through each user and for each one I'm looping through each contact to add/update. The code for each of these is as follows but it's pretty much what I said:

    // Business layer (called for each contact add/update)

    public string AddExchangeMailboxContact(string exchangeUser, Contact contact)
        var service = _dac.GetExchangeService(exchangeUser);
        var exchangeContact = new exch.Contact(service);

        exchangeContact = exchangeContact.PopulateContact(... [populates fields] ...);

        return _dac.AddExchangeMailboxContact(exchangeUser, service, exchangeContact);

    // Data layer (_dac)

    public string AddExchangeMailboxContact(string exchangeUser, exch.ExchangeService service, exch.Contact contact)
        return ExecuteExchangeCall(exchangeUser, service, svc =>
            return contact.Id.UniqueId;


    protected T ExecuteExchangeCall<T>(string exchangeUser, exch.ExchangeService service, Func<exch.ExchangeService, T> serviceFunction)
        var serviceUri = service.Url.ToString();
            return serviceFunction.Invoke(service);


    I'm not using ChangeKey at all. The thing is that this works fine for some users with over a thousand contacts but it sometimes breaks on random contacts where the user has more than a hundred or so. Then, upon retrying it, it works fine.


    Any help much appreciated.

    Wednesday, July 25, 2012 9:42 AM
  • >> upon retrying it, it works fine.

    Are you using Exchange 2010 ? that behaviour sounds like throttling http://technet.microsoft.com/en-us/library/dd297964 but the error you would be getting back would be different (if your using a service account you might want to try turning throttling off for that user), If you are using Exchange 2010 check the EWS Logs on your CAS server (located in C:\Program Files\Microsoft\Exchange Server\V14\Logging\Ews) to see what gets logged when the error occurs that should give you more information.

    Is it happening on Add or Update? these are two separate things and to update an Item you would first need to have the ItemId and ChangeKey. If other things are synchronizing against the Mailbox (eg ActiveSync, Android, Blackberry etc) you might find one of these processes is making changes at the same time. You can look at using ExMon http://www.microsoft.com/en-us/download/details.aspx?id=11461 to look at what other process/user/machine might be making changes at the same time. Also check the conflicts folder of the Mailbox you might find you have conflicts getting created if this is the case.


    Thursday, July 26, 2012 5:34 AM
  • Thanks for that Glen,

    I'll have a dig around and let you know what I come up with.

    Many thanks. :)

    Thursday, July 26, 2012 11:25 AM
  • Ever found the problem? I am experiencing same kin of error.
    Wednesday, July 10, 2013 2:27 PM
  • Unfortunately not. We think it's something to do with another process syncing the same contact at the same time but we've never been able to pin it down and we are unable to control the times that each system syncs.
    Wednesday, July 10, 2013 2:45 PM