0
votes

We have an Outlook plugin that calls back to our server when a new appointment item is saved. The plugin returns the Outlook item ID. We call ConvertId to get the EWS item ID. Here, itemId is the Outlook item ID.

AlternateId _alternateId = new AlternateId();
_alternateId.Format = idFormat;
_alternateId.Mailbox = mailboxAddress;
_alternateId.UniqueId = itemId;

AlternateIdBase _altBase = _exchangeService.ConvertId(_alternateId, IdFormat.EwsId);

This always works, or at least, we always get an EWS item ID returned.

Later, we try to get the appointment item to update it. Here, itemId is the EWS item ID.

// get the appointment using the EWS item Id of the appointment
Appointment appointment;
try
{
    appointment = Appointment.Bind(_exchangeService, new ItemId(itemId), propertySet);
    _exchangeService.LoadPropertiesForItems(new[] { appointment }, ExchangeWebService.GetRequiredPropertySet());
    return new ExchangeAppointment(appointment, exchangeUserName);
}

The problem is that rarely (perhaps 1% of the time) and intermittently, get appointment fails with ServiceError.ErrorItemNotFound. The same user can create a new appointment immediately after the one we have the problem with, and it will work.

We thought that it might be possible for ConvertId to return the item ID before the Exchange server had fully synchronised the item from Outlook so we added a retry every 10 seconds for a maximum of 10 minutes. In all cases where this fails, we see the retries happening but always exceeding 10 minutes at which point we give up and log the exception.

We can see the affected items in Outlook and the users are not deleting them.

The EWS logs simply mirror the ServiceError.ErrorItemNotFound exception.

At a loss where to go next?

1

1 Answers

1
votes

I would take a look at the values in the failure case. What value is returned from ConvertId, and what is the existing value on the item (you can use EWSEditor to get this). Maybe by comparing the values you can get a better idea of what's happening.