问题
I am facing several issues related to the creation of an ICS file which has to be compatible with several clients, especially iOS
, Gmail
, Outlook
, Android
and Windows Phone
. Googling around, I found out the proposed standard from 2009, aka RFC5546. I read through this document and found a point which is very interesting and could potentially solve my issue. Section Methods for VEVENT Calendar Components explains the distinctions between methods REQUEST and PUBLISH. But, there are a couple of points which are not really clear to me:
- What should PUBLISH do? Should it add a new calendar? Should it create a new calendar (like in Outlook or iOS) or should add the event in the existing user calendar (like in Gmail or Lightning)? EDIT: note the calendar as a file attached to an e-mail.
- Can PUBLISH contain more than one event? From the document and logically, yes, but Gmail then adds only the first event of the list. Lightning adds only one event and then gives a 804a0004 error.
- How should REQUEST work? The document states:
VEVENT | 1+ | All components MUST have the same UID.
which means a calendar may have more than 1 VEVENT but they must have the same UID. Then, how can I client distinguish between those events? And in fact no client I tried is able to distinguish the events generated with the same UID, but they add only the one with highest SEQUENCE. Logically, I don't want to send more than one event per invitation, but the RFC allows me to do that (and in my case study I want to), so how? - With REQUEST, forgetting the statement
VEVENT | 1+ | All components MUST have the same UID.
, so providing a unique UID to each event in the ICS file, Gmail and iOS add all the events contained in the file, while Lightning and Outlook add only the first one. Is there a way to pursue this path or since it should not be allowed I should find another way? - Basically, how do you suggest to proceed to add more events with a single ICS file to the users' calendar for the platforms I mentioned?
Sample ICS for PUBLISH:
BEGIN:VCALENDAR
PRODID:-//prodid//product//IT
VERSION:2.0
METHOD:PUBLISH
CALSCALE:GREGORIAN
BEGIN:VEVENT
UID:uid1
DTSTAMP:20130515T121437Z
DTSTART:20130619T205000
DTEND:20130619T215000
DESCRIPTION:Desc 1
SUMMARY:Sum 1
LOCATION:location
ORGANIZER:mailto:organizer@somedomain
SEQUENCE:1
STATUS:CONFIRMED
END:VEVENT
BEGIN:VEVENT
UID:uid2
DTSTAMP:20130515T121437Z
DTSTART:20130719T205000
DTEND:20130719T215000
DESCRIPTION:Desc 2
SUMMARY:Sum 2
LOCATION:location
ORGANIZER:mailto:organizer@somedomain
SEQUENCE:1
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR
Sample for REQUEST:
BEGIN:VCALENDAR
PRODID:-//prodid//product//IT
VERSION:2.0
METHOD:REQUEST
CALSCALE:GREGORIAN
BEGIN:VEVENT
UID:uid1
DTSTAMP:20130515T121437Z
DTSTART:20130619T205000
DTEND:20130619T215000
DESCRIPTION:Desc 1
SUMMARY:Sum 1
LOCATION:location
ORGANIZER:mailto:organizer@somedomain
ATTENDEE;RSVP=TRUE;CN=attendee cn:mailto:attendee@email
SEQUENCE:1
STATUS:CONFIRMED
END:VEVENT
BEGIN:VEVENT
UID:uid2
DTSTAMP:20130515T121437Z
DTSTART:20130719T205000
DTEND:20130719T215000
DESCRIPTION:Desc 2
SUMMARY:Sum 2
LOCATION:location
ORGANIZER:mailto:organizer@somedomain
ATTENDEE;RSVP=TRUE;CN=attendee cn:mailto:attendee@email
SEQUENCE:1
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR
回答1:
About 1) it is not clear how you communicate the events to the client: is it via iMIP (email) or through an HTTP URL ? In any case, there is no right answer to your question: iTIP is about transport of iCalendar data.
About 2) yes, you can have multiple events in a PUBLISH stream
About 3):
iCalendar has a notion of exception for recurring meetings. Those exceptions are represented by a VEVENT with the same UID and a RECURRENCE-ID indicating the particular instance that shall be considered an exception.
As a consequence, a REQUEST can only be used to transmit a single event (only one UID) but this event itself might be expressed as a set of VEVENT: one for the master (e.g. meeting every friday at 10:00) and one for each exception (e.g. except on Friday 12/12 where it will take place at 09:00).
See for example the last event in http://tools.ietf.org/html/rfc5546#section-4.4.8
来源:https://stackoverflow.com/questions/16567269/icalendar-creation-rfc-5546-explanation