Hello everyone.
We developed a program, which works with Exchange Server appointments through EWS Managed API. It was working fine untill we installed recent windows update KB2998527, which is associated with time zone changes in Russia. Now when program attempts to create appointment in Exchange, EWS throws such exception:
Microsoft.Exchange.WebServices.Data.TimeZoneConversionException: Unable to convert 2014-01-01T00:00:00.000 from (UTC+03:00) Moscow, St. Petersburg, Volgograd (RTZ 2) to UTC. ---> System.ArgumentException: The supplied DateTime represents an
invalid time. For example, when the clock is adjusted forward, any time in the period that is skipped is invalid.
Parameter name: dateTime
at System.TimeZoneInfo.ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone, TimeZoneInfoOptions flags, CachedData cachedData)
at Microsoft.Exchange.WebServices.Data.EwsUtilities.ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone)
--- End of inner exception stack trace ---
at Microsoft.Exchange.WebServices.Data.EwsUtilities.ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone)
at Microsoft.Exchange.WebServices.Data.ExchangeServiceBase.ConvertDateTimeToUniversalDateTimeString(DateTime value)
at Microsoft.Exchange.WebServices.Data.EwsServiceXmlWriter.TryConvertObjectToString(Object value, String& strValue)
at Microsoft.Exchange.WebServices.Data.EwsServiceXmlWriter.WriteElementValue(XmlNamespace xmlNamespace, String localName, String displayName, Object value)
at Microsoft.Exchange.WebServices.Data.EwsServiceXmlWriter.WriteElementValue(XmlNamespace xmlNamespace, String localName, Object value)
at Microsoft.Exchange.WebServices.Data.AbsoluteDateTransition.WriteElementsToXml(EwsServiceXmlWriter writer)
at Microsoft.Exchange.WebServices.Data.ComplexProperty.WriteToXml(EwsServiceXmlWriter writer, XmlNamespace xmlNamespace, String xmlElementName)
at Microsoft.Exchange.WebServices.Data.TimeZoneDefinition.WriteElementsToXml(EwsServiceXmlWriter writer)
at Microsoft.Exchange.WebServices.Data.ComplexProperty.WriteToXml(EwsServiceXmlWriter writer, XmlNamespace xmlNamespace, String xmlElementName)
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.WriteToXml(EwsServiceXmlWriter writer)
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.EmitRequest(IEwsHttpWebRequest request)
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.BuildEwsHttpWebRequest()
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(IEwsHttpWebRequest& request)
at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalCreateItems(IEnumerable`1 items, FolderId parentFolderId, Nullable`1 messageDisposition, Nullable`1 sendInvitationsMode, ServiceErrorHandling errorHandling)
at Microsoft.Exchange.WebServices.Data.Item.InternalCreate(FolderId parentFolderId, Nullable`1 messageDisposition, Nullable`1 sendInvitationsMode)
at Microsoft.Exchange.WebServices.Data.Appointment.Save(WellKnownFolderName destinationFolderName, SendInvitationsMode sendInvitationsMode)
This exception is thrown only if ExchangeService object is instantiated with time zone (UTC+03:00) Moscow, St. Petersburg, Volgograd (RTZ 2). If we use different time zone everything is OK. Date of the appointment is not 2014-01-01T00:00:00.000
So here is the question: why this error may hapen and how it can be fixed?
Any help will be greatly appreciated.
Thanks.