try

        {                

            results = this.exchangeService.GetUserAvailability(attendees, new TimeWindow(startTime, endTime), AvailabilityData.FreeBusy);           

         }

        catch (Exception ex)

        {

            string attendeesString = string.Empty;

            foreach (AttendeeInfo item in attendees)

            {

                attendeesString += item.SmtpAddress + "; ";

            }



            LogData logData = MethodLogUtilityForExchange.GetLogDataGetAttendeesAvailabilityDebug(attendeesString, startTime, endTime, ex);              

            LogUtility.LogException(logData, "EWS GetAttendeesAvailability Exception", ex, LogCategory.MethodInformation);

            throw;

        }

Exception stack trace :

ExceptionSystem.ArgumentException: An item with the same key has already been added.

at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)

at Microsoft.Exchange.WebServices.Data.ExchangeServiceBase.SaveHttpResponseHeaders(WebHeaderCollection headers)

at Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.ReadResponse(HttpWebResponse response)

at Microsoft.Exchange.WebServices.Data.GetUserAvailabilityRequest.Execute()

at Microsoft.Exchange.WebServices.Data.ExchangeService.GetUserAvailability(IEnumerable`1 attendees, TimeWindow timeWindow, AvailabilityData requestedData)

at Intel.Exchange.WebServices.Extension.ExchangeServiceManager.GetAttendeesAvailability(List`1 attendees, DateTime startTime, DateTime endTime)

Can you help in understanding the issue ? we are not handling any Dictionary explicitly here. but still we see the Dictionary key error. Not sure What would have gone wrong.

1

There are 1 best solutions below

0
On

You might not be using any Dictionary, but apparently EWS is in its HTTP response processing. It almost looks like EWS has returned a duplicate response header. You might have to get a Fiddler trace or some such to see that. One thing to check (altho how this would cause this error is beyond me): do each of the 'attendees' have a different SMTP address? Just a shot in the dark.