Search code examples
exchangewebservicesexchange-server-2010

EWS update changes time zone to UTC


I've seen this question asked several times on the web, but cannot find an answer.

When I create an appointment (meeting) using managed EWS 2.0, the invitation email correctly shows the time and time zone. When I update the meeting, the new invitation emails show the time in the UTC time zone. It is the correct time for UTC, but should display in Pacific.

I have tried setting the zone when creating the service connection, but this makes the initial invitation also show the time zone as UTC, as well as any updates.

I've tried setting the StartTimeZone and EndTimeZone properties, and have included those properties in the property set when binding the appointment for modification.

Is there another property somewhere that controls how Exchange formats the time when sending out the invitations? Here is some code showing how I am performing the updates:

        Dim EWS As ExchangeService = GetEWSConnection(UserEmailAddress)
        Dim meeting As Appointment = Appointment.Bind(EWS, New ItemId(CalendarEvent.ItemKey), New PropertySet(BasePropertySet.IdOnly, AppointmentSchema.Start, AppointmentSchema.End, AppointmentSchema.ReminderDueBy, AppointmentSchema.StartTimeZone, AppointmentSchema.EndTimeZone, AppointmentSchema.TimeZone, AppointmentSchema.Subject, AppointmentSchema.Location, AppointmentSchema.Body))
        Dim timeZone As TimeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(LocalTimeZoneID)
        With meeting
            .Subject = CalendarEvent.Subject
            .Location = CalendarEvent.Location
            .Body = CalendarEvent.Body
            .Start = CalendarEvent.StartTime
            .End = CalendarEvent.EndTime
            .StartTimeZone = timeZone
            .EndTimeZone = timeZone
            '  snip  (removed attendee add/remove)
            .Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToChangedAndSaveCopy)
        End With

Solution

  • I realize that this is a frustrating answer, but I believe this to be an Exchange bug. No matter how you adjust the various time zone properties exposed by the API, this behavior still occurs. As far as I can tell, there aren't any server-level settings that would affect this either, although I admittedly haven't combed through all of them.

    In my case, what seems to go along with the appended UTC time is that the message is changed from its original HTML to a plain text version upon update. That bug (http://support.microsoft.com/kb/2689810) has been fixed, but my organization hasn't applied the patch yet. It's possible, I suppose, that this bug was rendered obsolete when the other was fixed. If installing an update on your Exchange server is an option, then that might be worth a shot.