Exchange Api在以色列时区发送错误的邀请

时间:2013-07-12 06:33:47

标签: api timezone exchange-server

我遇到了使用交换API在.net中发送邀请的问题

以色列时区发送邀请,开始时间= 09/09/2013 4.30以色列。

但它显示在Outlook 09/09/2013 6.30以色列。

适用于其他时区,例如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

1 个答案:

答案 0 :(得分:0)

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