0
votes

I am trying to specify timezone of EWS invitations when any existing appointment get updated. Here is my code:

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1, TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"));
service.Credentials = new WebCredentials("ews_calendar", PASSWORD, "acme");
service.Url = new Uri("https://acme.com/EWS/Exchange.asmx");

Appointment newAppointment = new Appointment(service);
newAppointment.Subject = "Test Subject";
newAppointment.Body = "Test Body";
newAppointment.Start = new DateTime(2012, 02, 28, 17, 00, 0);
newAppointment.End = newAppointment.Start.AddMinutes(30);
newAppointment.RequiredAttendees.Add("[email protected]");

//When: Tuesday, February 28, 2012 5:00 PM-5:30 PM. (UTC-05:00) Eastern Time (US & Canada)
newAppointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);

string itemId = newAppointment.Id.ToString();

Appointment existingAppointment = Appointment.Bind(service, new ItemId(itemId));
existingAppointment.Start = new DateTime(2012, 02, 28, 18, 00, 0);
existingAppointment.End = existingAppointment.Start.AddMinutes(30);

//When: Tuesday, February 28, 2012 11:00 PM-11:30 PM. UTC
existingAppointment.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToAllAndSaveCopy);

EWS use proper timezone (UTC-05:00) when it create new appointment (newAppointment.Save in above code) and send invitations to attendees. But when EWS updates any existing appointment and send updated invitations, it use incorrect timezone as UTC.

Note that I am specifying "Eastern Standard Time" timezone while creating instance of exchange service object.

1

1 Answers

0
votes

Try to set StartTimeZone and EndTimeZone properties also on the Appointment object when your ExchangeService object is instantiated as:

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);

The behavior of the StartTimeZone and EndTimeZone properties varies based on the version of Microsoft Exchange Server that you are running. See more details: Time zones in the EWS Managed API.