Title: TimeZone change to UTC while updating the Appointment
Tags: sharepoint-2010;exchangewebservices;exchange-server-2010
Question: I am using EWS 1.2 to send appointments. On creating new Appointments, TimeZone is showing properly on notification mail, but on updating the same appointment, it's TimeZone reset to UTC.
Could anyone help me to fix this issue?
Here is sample code to replicate the issue:
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, 03, 27, 17, 00, 0);
newAppointment.End = newAppointment.Start.AddMinutes(30);
newAppointment.RequiredAttendees.Add("xanderson@example.com");
//Attendees get notification mail for this appointment using (UTC-05:00) Eastern Time (US &amp; Canada) timezone
//Here is the notification content received by attendees:
//When: Tuesday, March 27, 2012 5:00 PM-5:30 PM. (UTC-05:00) Eastern Time (US &amp; Canada)
newAppointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);
// Pull existing appointment
string itemId = newAppointment.Id.ToString();
Appointment existingAppointment = Appointment.Bind(service, new ItemId(itemId));
//Attendees get notification mail for this appointment using UTC timezone
//Here is the notification content received by attendees:
//When: Tuesday, March 27, 2012 11:00 PM-11:30 PM. UTC
existingAppointment.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToAllAndSaveCopy);

Here is the accepted answer: You'll want to set AppointmentSchema.StartTimeZone and bind it as part of the properties object when you bind existingAppointment, as illustrated here:
// Get an existing calendar item, requesting the Id, Start, and
//  StartTimeZone properties.
PropertySet props = new PropertySet(
AppointmentSchema.Id,
AppointmentSchema.Start,
AppointmentSchema.StartTimeZone);
Appointment appt = Appointment.Bind(service, new ItemId("AQMkA="), props);
It seems the default bound time zone is UTC.
Comment for this answer: @FirozAnsari: Do you always want the same time zone? If so, have you tried just explicitly setting it on the one you're updating? Maybe it's not being fetched properly.
Comment for this answer: @FirozAnsari Understood. Likewise, what happens when you bind it for `newAppointment` in your code above? The [linked article](http://msdn.microsoft.com/en-us/library/ee332363(v=exchg.140).aspx) seems to cover many cases for this exact issue and feature in EWS for Exchange 2010. Unless you can gather more information on the properties of your server, I believe poking at the connection with a well-defined timezone is the most appropriate course of action.
Comment for this answer: I set AppointmentSchema.StartTimeZone as you suggested but still EWS sending notification mail in UTC timezone.
Comment for this answer: Thanks MrGomez. With newAppointment, notification timezone is proper. My only problem is with updating existing appointments. I looked into this article and this article explains how to convert start & end date to specific timezone. I am not sure how I can convert the dates while calling existingAppointment.Update. Thank you once again for your help.

Here is another answer: Try out using an other overload of Bind() which allows explicitly specifying which properties to load. Basically specify all TimeZone specific property definition in third parameter of Bind(), regarding MSDN's paper To change the time zone for an appointment without changing the start time:
Bind to the existing appointment by using its unique identifier. The
following code shows how to bind to an existing appointment, provide
it with connection configuration information by using an
ExchangeService object named service, and request a specific subset of
properties, including the DateTime properties and the time zone
properties. The ItemId has been shortened to preserve readability. For
the purpose of this example, assume that the service object is scoped
to the Pacific Standard Time (PST) time zone.
var appt = Appointment.Bind(
service,
new ItemId(itemId),
new PropertySet(
BasePropertySet.IdOnly,
AppointmentSchema.Start,
AppointmentSchema.ReminderDueBy,
AppointmentSchema.End,
AppointmentSchema.StartTimeZone,
AppointmentSchema.EndTimeZone,
AppointmentSchema.TimeZone));
appt.StartTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Coordinated Universal Time");
appt.EndTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Coordinated Universal Time");
appt.Update(
ConflictResolutionMode.AlwaysOverwrite,
SendInvitationsOrCancellationsMode.SendToAllAndSaveCopy);
appt.Load(new PropertySet(
BasePropertySet.IdOnly,
AppointmentSchema.Start,
AppointmentSchema.ReminderDueBy,
AppointmentSchema.End,
AppointmentSchema.StartTimeZone,
AppointmentSchema.EndTimeZone,
AppointmentSchema.TimeZone));
Also below you can find useful MSDN how-tos:
Your case: Updating the time zone for items by using the EWS Managed API
Getting time zone definitions by using the EWS Managed API
Specifying the time zone when creating items by using the EWS Managed API
Specifying the time zone when retrieving items by using the EWS Managed API

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2012:00:03/28/12', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<sharepoint-2010><exchangewebservices><exchange-server-2010>', 'Title': 'TimeZone change to UTC while updating the Appointment', 'ViewCount': 2240, 'id': 9910129, 'user_AboutMe': None, 'user_AccountId': 1109756.0, 'user_DisplayName': 'Firoz Ansari', 'user_Reputation': 2473.0, 'user_Views': 256.0, 'user_id': 1100452.0}}