Outlook not importing VCS with timezones correctly

2019-06-02 22:07发布

On our web app in ASP, we have a module that generates VCS files to be imported into your calendar. This works fine if the client is on the same zone as us (GMT).

But If I create an event which starts at 9am in UTC-01 for example, I still get the event as starting at 9am UTC/GMT, it's like it won't read the TZOFFSET

This is the VCS generated. In this example the event is supposed to take place Dec 30th 2011 9am-10am in UTC-05 (New York). If I leave my time zone as GMT, I get the appointment as 9am-10am instead of calculating the time difference. Even if I change my timezones it always calculates the difference against GMT and not the Time Zone where the event is taking place.

BEGIN:VCALENDAR
METHOD:REQUEST
PRODID:-Microsoft
VERSION:2.0
BEGIN:VTIMEZONE
TZID:America/New_York
TZ:UTC-05
X-MICROSOFT-CDO-TZID:10
BEGIN:STANDARD
DTSTART:20111230T090000
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
BEGIN:DAYLIGHT
DTSTART: 20111230T090000
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20111116T100300Z
DTSTART;TZID=America/New_York:20111230T090000
SUMMARY;ENCODING=QUOTED-PRINTABLE:TEST
UID:12347a7833h
ORGANIZER;CN=Test:MAILTO:test@test.com
LOCATION;ENCODING=QUOTED-PRINTABLE:Hall A
DTEND;TZID=America/New_York:20111230T100000
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:
SEQUENCE:0
PRIORITY:5
TRANSP:OPAQUE
CATEGORIES:Test
CLASS:PUBLIC
END:VEVENT
END:VCALENDAR

I've been googling around for several days now and can't seem to find any good documentation on how to generate VCS correctly.

Any help will be great!

Thanks, Federico

2条回答
Emotional °昔
2楼-- · 2019-06-02 22:42

I'm sure the OP has solved this already, but here's a great blog post that discusses the proprietary "X-MICROSOFT-CDO-TZID" tag that Microsoft uses to help with timezone interpretation in Outlook: http://hello-dot-wordpress.blogspot.com/2009/10/my-guide-to-x-microsoft-cdo-tzid.html

Edit: Updated Link.

查看更多
再贱就再见
3楼-- · 2019-06-02 22:43

Here's the text from the blog post I mentioned (which is no longer available):

==========

Here's the issue: If you search Google on how to create an Outlook Calendar email notification/ics file, you might stumble across this page which has a generic template you could use. Or you might send yourself an invitation and look at the source code for the ICS file.

Either way you'll see the following lines within the VTIMEZONE block:

TZID:(GMT-05.00) Eastern Time (US & Canada)
X-MICROSOFT-CDO-TZID:10

Notice the strange X-MICROSOFT-CDO-TZID line... it simply has a number, "10". Well, according to Microsoft the number 10 represents the Eastern Time Zone here in America. Searching Google you might see more examples of this strange number/location mapping but you'll be hard pressed to find a complete listing of all the mappings. 11 is Central Time, 12 is Mountain Time, 13 is Pacific Time, but 38 is Mountain Time for Arizona...?

After much research (and a phone call to a MSFT employee), we found this document deep within a MSDN website: http://msdn.microsoft.com/en-us/library/aa563018(loband).aspx

It documents all the time zone "numbers" you'll need to use in order to correctly set up an ICS file.

==========

Cheers!

查看更多
登录 后发表回答