【发布时间】:2014-01-31 11:05:05
【问题描述】:
我在使用 Exchange API 在 .net 中发送邀请时遇到了以下问题
在以色列时区发送邀请,开始时间 = 09/09/2013 4.30 Israel。
但它显示在 Outlook 09/09/2013 6.30 Israel.
它适用于其他时区,例如 EST。
有人知道如何解决这个问题吗?
示例:
service.AutodiscoverUrl(loginForm.tbEmailAddress.Text, f);
TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("Israel Standard Time");
Appointment appointment = new Appointment(service);
appointment.Subject = "subj";
appointment.Body = new MessageBody(BodyType.Text, "body");
appointment.StartTimeZone = timeZoneInfo;
appointment.Start = GetDateTime(new DateTime(2013, 09, 09, 04, 0, 0));
appointment.EndTimeZone = timeZoneInfo;
appointment.End = GetDateTime(new DateTime(2013, 09, 09, 04, 30, 0));
appointment.IsAllDayEvent = false;
appointment.Importance = Importance.Normal;
appointment.RequiredAttendees.Add("Lena", "email...");
appointment.Save(SendInvitationsMode.SendOnlyToAll);
...
private static DateTime GetDateTime(DateTime dateTime)
{
return new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute,
dateTime.Second, dateTime.Millisecond, DateTimeKind.Unspecified
);
}
我使用 Microsoft.Exchange.WebServices.dll 15.0.516.14
【问题讨论】:
-
GetDateTime方法除了将Kind设置为Unspecified外,什么也不做。所以你可以摆脱它。您的其余代码看起来应该可以正常工作。我看不出有什么问题。你能显示它在 Outlook 中的部分截图吗?请务必检查工具栏中的时区按钮,以便我们可以在屏幕截图中看到它们。另外,您正在运行哪些版本的 Outlook 和 Exchange? -
在outlook中以3个不同的时间显示:主题4-4.30; 5-5.30作为开始时间;日历 6-6.30
-
这是在 Exchange 2010 (office 365) 上复制的。展望 2010 - 14.0.6129.5000(64 位)
-
通过安装来自微软的以下更新为我解决了这个问题 - support.microsoft.com/kb/2794119
标签: api timezone exchange-server