Hi,
I have written an application which executes a search on Exchange 2013 with an impersonated user (which is a mandatory requirement). This search includes not the return items which a have custom property set to a non empty value. This works pretty fine. The property is used to determine if the application already processed an item or not.
After the processing has been finished I try to set the property. In most cases this works perfect, but I also get a "An item with the same key has already been added" exception when calling EmailMessage.Update() method.
Next you will see the code I am working with to update the property and the stack trace of the error. If required I will post more information on your demand.
msg.SetExtendedProperty(property, value); msg.Update(ConflictResolutionMode.AlwaysOverwrite);SetProperty Exception: Ein Element mit dem gleichen Schlüssel wurde bereits hinzugefügt.
bei System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
bei Microsoft.Exchange.WebServices.Data.ExchangeServiceBase.SaveHttpResponseHeaders(WebHeaderCollection headers)
bei Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.ReadResponse(IEwsHttpWebResponse response)
bei Microsoft.Exchange.WebServices.Data.ExchangeService.InternalUpdateItems(IEnumerable`1 items, FolderId savedItemsDestinationFolderId, ConflictResolutionMode conflictResolution, Nullable`1 messageDisposition, Nullable`1 sendInvitationsOrCancellationsMode, ServiceErrorHandling errorHandling)
bei Microsoft.Exchange.WebServices.Data.ExchangeService.UpdateItem(Item item, FolderId savedItemsDestinationFolderId, ConflictResolutionMode conflictResolution, Nullable`1 messageDisposition, Nullable`1 sendInvitationsOrCancellationsMode)
bei Microsoft.Exchange.WebServices.Data.Item.InternalUpdate(FolderId parentFolderId, ConflictResolutionMode conflictResolutionMode, Nullable`1 messageDisposition, Nullable`1 sendInvitationsOrCancellationsMode)
bei Microsoft.Exchange.WebServices.Data.Item.Update(ConflictResolutionMode conflictResolutionMode)
Thanks for your help,
Seb