How to specify EDT (daylight saving time) to Exchange Web Services (XML not managed)?

孤者浪人 提交于 2019-12-02 04:43:01
Matt Johnson-Pint

The Windows Time Zone key you're looking for is exactly: "Eastern Standard Time". This covers the US Eastern time zone, inclusive of both Eastern Standard Time and Eastern Daylight Time. It has a display name of "(UTC-05:00) Eastern Time (US & Canada)".

This is actually one of the examples I call out in the timezone tag wiki - which you should read if you haven't already.

The other key you found "US Eastern Standard Time" is actually for the zone with the display name of "(UTC-05:00) Indiana (East)" - which is segregated for historical reasons and is now obsolete. (See the Wikipedia entry on Time in Indiana, and Microsoft's KB article on this if you are interested in why.)

If you look in the Windows Registry at HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones, you will see the valid keys. In each key, you will see the Display name that corresponds to each. This explains how they appear when you change your time zone in Windows.

With regards to Exchange Web Services, in the article you mentioned, it does talk about how you can use the key name. But it also talks about how you can pass much more information in the MeetingTimeZone element and use a display name instead.

If interoperability with Google Calendar (and others) is important, you might consider passing the IANA time zone name in the TimeZoneName attribute - in this case it would be America/New_York. You would still need to provide the <BaseOffset>, <Standard>, and <Daylight> elements, so that it will work right on Windows. See the MeetingTimeZone section in that article.

I should state that I haven't tried this approach myself, but it appears from the documentation that if you provide those elements that the TimeZoneName becomes less important to Windows but would still get passed along.

You should certainly be able to pass it using Microsoft's approach:

<MeetingTimeZone TimeZoneName="(GMT-05:00) Eastern Time (US &amp; Canada)">
  <BaseOffset>P0DT5H0M0.0S</BaseOffset>
  <Standard>
    <Offset>P0DT0H0M0.0S</Offset>
    <RelativeYearlyRecurrence>
      <DaysOfWeek>Sunday</DaysOfWeek>
      <DayOfWeekIndex>First</DayOfWeekIndex>
      <Month>November</Month>
    </RelativeYearlyRecurrence>
    <Time>02:00:00.0000000</Time>
  </Standard>
  <Daylight>
    <Offset>-P0DT1H0M0.0S</Offset>
    <RelativeYearlyRecurrence>
      <DaysOfWeek>Sunday</DaysOfWeek>
      <DayOfWeekIndex>Second</DayOfWeekIndex>
      <Month>March</Month>
    </RelativeYearlyRecurrence>
    <Time>02:00:00.0000000</Time>
  </Daylight>
</MeetingTimeZone>

What I'm suggesting is that you tweak it slightly by passing the IANA zone name instead and see if it behaves properly with Gmail and Google Calendar:

<MeetingTimeZone TimeZoneName="America/New_York">
  <BaseOffset>P0DT5H0M0.0S</BaseOffset>
  <Standard>
    <Offset>P0DT0H0M0.0S</Offset>
    <RelativeYearlyRecurrence>
      <DaysOfWeek>Sunday</DaysOfWeek>
      <DayOfWeekIndex>First</DayOfWeekIndex>
      <Month>November</Month>
    </RelativeYearlyRecurrence>
    <Time>02:00:00.0000000</Time>
  </Standard>
  <Daylight>
    <Offset>-P0DT1H0M0.0S</Offset>
    <RelativeYearlyRecurrence>
      <DaysOfWeek>Sunday</DaysOfWeek>
      <DayOfWeekIndex>Second</DayOfWeekIndex>
      <Month>March</Month>
    </RelativeYearlyRecurrence>
    <Time>02:00:00.0000000</Time>
  </Daylight>
</MeetingTimeZone>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!