1

我在使用交换 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

4

1 回答 1

0

这实际上是 Exchange EWS 本身的一个已知问题。开发人员只能信任返回的没有时区信息的日期时间,并且该时间的正确时区应始终为 UTC。

于 2014-01-31T03:05:05.260 回答