可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I'm generating ICalendar (.ics) files.
Using the UID and SEQUENCE fields I can update existing events in Google Calendar and in Windows Calendar BUT NOT in MS Outlook 2007 - it just creates a second event
How do I get them to work for Outlook ?
Thanks
Tom
回答1:
I've continued to do some testing and have now managed to get Outlook to update and cancel events based on the .cs file.
Outlook in fact seems to respond to the rules defined in RFC 2446
In summary you have to specify
METHOD:REQUEST
and ORGANIZER:xxxxxxxx
in addition to UID
: and SEQUENCE:
For a cancellation you have to specify METHOD:CANCEL
Request/Update Example
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//SYFADIS//PORTAIL FORMATION//FR
METHOD:REQUEST
BEGIN:VEVENT
UID:TS_229377_MS_262145@syfadis.com
SEQUENCE:5
DTSTAMP:20081106T154911Z
ORGANIZER:catalog@syfadis.com
DTSTART:20081113T164907
DTEND:20081115T170000
SUMMARY:TestTraining
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR
Cancel Example;
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//SYFADIS//PORTAIL FORMATION//FR
METHOD:CANCEL
BEGIN:VEVENT
UID:TS_229377_MS_262145@syfadis.com
SEQUENCE:7
DTSTAMP:20081106T154916Z
ORGANIZER:catalog@syfadis.com
DTSTART:20081113T164907
SUMMARY:TestTraining
STATUS:CANCELLED
END:VEVENT
END:VCALENDAR
回答2:
I got a hold of Tom Carter, the asker. He had a working example with a request followed by a cancellation. What I had wrong was my METHOD was inside my VEVENT when it should have been outside. So here is a working update!
Original:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//WA//FRWEB//EN
METHOD:REQUEST
BEGIN:VEVENT
UID:FRICAL201
SEQUENCE:0
DTSTAMP:20081108T151809Z
ORGANIZER:donotreply@test.com
DTSTART:20081109T121200
SUMMARY:11/9/2008 12:12:00 PM TRIP FROM JFK AIRPORT (JFK)
LOCATION:JFK AIRPORT (JFK)
END:VEVENT
END:VCALENDAR
Update:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//WA//FRWEB//EN
METHOD:REQUEST
BEGIN:VEVENT
UID:FRICAL201
SEQUENCE:1
DTSTAMP:20081108T161809Z
ORGANIZER:donotreply@test.com
DTSTART:20081109T121300
SUMMARY:11/9/2008 12:13:00 PM TRIP FROM JFK AIRPORT (JFK)
LOCATION:JFK AIRPORT (JFK)
END:VEVENT
END:VCALENDAR
All I did was add the request method (in the correct spot!), and an organizer.
回答3:
I am using outlook 2003 (from reading the posts, 2007 appears to behave in the same way) and you need to clearly distinguish between the behaviour of the explicit file import of an ics file and the implicit import when an ics file is 'double clicked'.
On the Outlook menu File / Import and Export ... Outlook will load as many VEVENT entries as are in the file and no amount of changing UID:, SEQUENCE: or DTSTAMP: values changes this, i.e.if you change any data and re-import it you just get a duplicate set of entries.
If you double click on an ics file it processes the first VEVENT entry only. However it does recognise the UID and, if the DTSTAMP: is later (the SEQUENCE can be the same but not lower) you will be prompted and it will update the event in your calendar.
BEGIN:VCALENDAR
VERSION:2.0
PRODID:www.membership-services.net
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20090126T210000
DTEND:20090126T220000
SUMMARY:Avondale - Thameside Away Game vs Croydon
LOCATION:Whitgift School
DESCRIPTION:http://maps.google.co.uk/maps?f=q&hl=en&geocode=&q=CR2+6YT
UID:AWPC_8
SEQUENCE:0
DTSTAMP:20090123T112600
END:VEVENT
BEGIN:VEVENT
DTSTART:20090202T213000
DTEND:20090202T223000
SUMMARY:Avondale - Thameside Home Game vs Orcas
LOCATION:Putney
DESCRIPTION:http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&ie=UTF8&ll=51.4635,-0.2285&spn=0.005,0.009613&t=h&z=17&iwloc=lyrftr:w2t.90,0x48760f04a04b1801:0x49ebf12503a5d5a9,51.463459,-0.228674
UID:AWPC_10
SEQUENCE:0
DTSTAMP:20090123T112600
END:VEVENT
END:VCALENDAR
回答4:
add this to your ICS file
X-WR-RELCALID:MyCal123
where MyCal123 is a unique identifier for your calendar.
By adding this line to an ICS file the entire calendar gets updated (after a prompt in Outlook). You don't even need to change the DTSTAMP or SEQUENCE or ORGANIZER and METHOD:PUBLISH is fine for the update. Just update the event details, double-click the ICS and the calendar will update. Note that this also works fine if you have published the calendar and provided a URL for people to view it. They just need to hit refresh after about 2mins and they will also get the update.
Thanks to David Bjørnhart for pointing this out: ICal import creates new calendar When Open the ics file
回答5:
I'm using Entourage, so this may not match up exactly with the behavior you're seeing, but I hope it helps.
Using the iCalendar from your reply, Entourage wouldn't even import the data. Using a known-good file, I got it to import, then successfully update. Comparing the two files, the only structural differences are as follows:
- My known-good doesn't have a
VERSION
element
- My known-good doesn't have a
PRODID
element
- My known-good doesn't have a
STATUS
element
- My known-good doesn't have a
SEQUENCE
element
Since Microsoft's support for open standards tends to lag, I'd suggest trying without the VERSION
info.