title: iCalendar creation: RFC 5546 explanation
body: <p>I am facing several issues related to the creation of an ICS file which has to be compatible with several clients, especially <code>iOS</code>, <code>Gmail</code>, <code>Outlook</code>, <code>Android</code> and <code>Windows Phone</code>. Googling around, I found out the proposed standard from 2009, aka <a href="https://www.rfc-editor.org/rfc/rfc5546" rel="nofollow noreferrer">RFC5546</a>. I read through this document and found a point which is very interesting and could potentially solve my issue. Section <a href="https://www.rfc-editor.org/rfc/rfc5546#section-3.2" rel="nofollow noreferrer">Methods for VEVENT Calendar Components</a> explains the distinctions between methods REQUEST and PUBLISH. But, there are a couple of points which are not really clear to me:</p>
  <ol>
  <li>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)? <em>EDIT: note the calendar as a file attached to an e-mail.</em></li>
  <li>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.</li>
  <li>How should REQUEST work? The document states: <code>VEVENT | 1+ | All components MUST have the same UID.</code> 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?</li>
  <li>With REQUEST, forgetting the statement <code>VEVENT | 1+ | All components MUST have the same UID.</code>, 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?</li>
  <li>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?</li>
  </ol>
  <p>Sample ICS for PUBLISH:</p>
  <pre><code>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
  </code></pre>
  <p>Sample for REQUEST:</p>
  <pre><code>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
  </code></pre>