[EWSMA] [E2007][C#] Workaround needed for BindToRecurringMaster throwing exception because of appointment TimeZone null RRS feed

  • Question

    • I'm using EWS Managed API version 1.1 to sync appointments from Outlook calendar.

      Recently I have some errors reported from clients saying "Value cannot be null. Parameter name: id".

      My logs shows  the call stack that I included at the bottom.

      Debugging, I found out that whenever I try to get a RecurringMaster starting from the id of one of its occurrence (either if it's by using BindToRecurringMaster  or  by "RecurringAppointmentMasterId recMasterid = new RecurringAppointmentMasterId(new ItemId(idOfOccurrence.UniqueId).ToString()); master = Appointment.Bind(binding, recMasterid);" ) , IF the TimeZone of the ocurrence is null then I will get an exception thrown when trying to get the RecurringMaster.


      Now 3 questions:

      1.) Does anybody know how can it be that the TimeZone of the appointment ended up null ?

      2.)  How can I obtain the recurringMaster Id, starting from such an occurrence that has null TimeZone

      3.) I thought that I could get round this by identifying if the TimeZone is null before trying to get the recurring master and setting it myself to TimeZone.Local.

      As appointment.TimeZone doesn't have a setter I tried to update the StartTimeZone value. Unfortunatelly, setting StartTimeZone  to non null doesn't seem to help as TimeZone still remains null.

      How can I update the appointment.TimeZone ?

      Many thanks


      Call stack showing BindToRecurringMaster broken by TimeZone being null:

      11.41.57 Value cannot be null.
      Parameter name: id
         at System.TimeZoneInfo.GetTimeZone(String id)
         at System.TimeZoneInfo.FindSystemTimeZoneById(String id)
         at Microsoft.Exchange.WebServices.Data.MeetingTimeZone.ToTimeZoneInfo()
         at Microsoft.Exchange.WebServices.Data.MeetingTimeZonePropertyDefinition.LoadPropertyValueFromXml(EwsServiceXmlReader reader, PropertyBag propertyBag)
         at Microsoft.Exchange.WebServices.Data.PropertyBag.LoadFromXml(EwsServiceXmlReader reader, Boolean clear, PropertySet requestedPropertySet, Boolean onlySummaryPropertiesRequested)
         at Microsoft.Exchange.WebServices.Data.EwsServiceXmlReader.ReadServiceObjectsCollectionFromXml[TServiceObject](String collectionXmlElementName, GetObjectInstanceDelegate`1 getObjectInstanceDelegate, Boolean clearPropertyBag, PropertySet requestedPropertySet, Boolean summaryPropertiesOnly)
         at Microsoft.Exchange.WebServices.Data.GetItemResponse.ReadElementsFromXml(EwsServiceXmlReader reader)
         at Microsoft.Exchange.WebServices.Data.ServiceResponse.LoadFromXml(EwsServiceXmlReader reader, String xmlElementName)
         at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.ParseResponse(EwsServiceXmlReader reader)
         at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ReadResponse(EwsServiceXmlReader ewsXmlReader)
         at Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.ReadResponse(HttpWebResponse response)
         at Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.InternalExecute()
         at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute()
         at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalBindToItems(IEnumerable`1 itemIds, PropertySet propertySet, ServiceErrorHandling errorHandling)
         at Microsoft.Exchange.WebServices.Data.ExchangeService.BindToItem(ItemId itemId, PropertySet propertySet)
         at Microsoft.Exchange.WebServices.Data.ExchangeService.BindToItem[TItem](ItemId itemId, PropertySet propertySet)
         at Microsoft.Exchange.WebServices.Data.Appointment.BindToRecurringMaster(ExchangeService service, ItemId occurrenceId, PropertySet propertySet)
         at Microsoft.Exchange.WebServices.Data.Appointment.BindToRecurringMaster(ExchangeService service, ItemId occurrenceId)
         at Formula.Connectors.ExchangeEWSAPIHandler.GetAppointments(ExchangeService exchangeServiceBind, String calendarName)

    Monday, December 6, 2010 8:52 PM

All replies

  • Hi

    Did you find a fix for this?

    I am getting the same error when I try to bind to a recurring meeting item in a pull subscription eventhandler.

    EWSMAPI 1.1 on a 2010 SP1 server.

    The strange thing is that on another 2010 server (my test server) the same code does not produce an error with the same type of items.

    So I do


      For Each element As ItemEvent In events.ItemEvents
      itm = Item.Bind(service, element.ItemId)
    and error out on : Value cannot be null. Parameter name: id


    Thanks, John
    Friday, January 28, 2011 8:36 PM
  • I have the same problem, but it only seems to happen with appointments created on a mobile device (tested it with an iPhone 4 and a Samsung Galaxy S). Appointments created with Outlook 2007/2010 and/or OWA seem to fine here.
    Monday, September 5, 2011 6:27 AM