sharepoint-2010 - 更新约会时时区更改为 UTC

标签 sharepoint-2010 exchangewebservices exchange-server-2010

我正在使用 EWS 1.2 发送约会。在创建新约会时,时区在通知邮件上正确显示,但在更新同一约会时,时区重置为 UTC。

谁能帮我解决这个问题?

这是复制问题的示例代码:

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("tin.tin@acme.com");

//Attendees get notification mail for this appointment using (UTC-05:00) Eastern Time (US & 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 & 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);

最佳答案

您需要设置 AppointmentSchema.StartTimeZone并在绑定(bind) existingAppointment 时将其绑定(bind)为属性对象的一部分,如 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);

似乎默认绑定(bind)时区是 UTC。

关于sharepoint-2010 - 更新约会时时区更改为 UTC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9910129/

相关文章:

java - 在 EWS Java API 代码中将身份验证设置为 Basic 以发送邮件

python - 如何在 Python 中从 MS exchange 获取所有邮件?

sharepoint - 使用 javascript 客户端对象模型检查当前用户是否属于 SP 组

Sharepoint 库项目 View - 项目计数以及查看该项目的人员

java - 将电子邮件从本地文件系统恢复到 ews api 中的 Exchange 帐户

c# - 使用 EWS 托管 API 维护拉取通知中的亲和性

c# - 使用 C# 确定系统上 Exchange 服务器的版本

c# - 从 EWS 导出可在 MS Outlook 中打开的电子邮件消息

sharepoint-2010 - SharePoint CAML 查询 AND/OR 运算符

sharepoint-2010 - 使用 SPGridView 的分页错误