Icalendar ICS update not working in google calendar

后端 未结 3 674
孤街浪徒
孤街浪徒 2021-01-11 17:24

I have some trouble with the ICS attachment to Gmail/Google calendar addresses. When I have to edit an event I send an update by mail with an ICS file with the same UID of t

3条回答
  •  孤独总比滥情好
    2021-01-11 17:56

    Some of the answers provided are not (entirely) correct.

    In short, your ATTENDEE property needs more arguments to make sure Google Calendar considers it an update:

    ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=
    TRUE;CN=Recipient Name;X-NUM-GUESTS=0:mailto:recipient@gmail.com
    

    I had the same problem and to find the answer I:

    1. Sent myself an invitation using Google Calendar itself + an updated invitation
    2. Compared the two .ics files
    3. Ran many different self-generated variations on those two .ics files to find out which parameters were really necessary

    These are my findings:

    • Increment SEQUENCE from 0 to 1 (or further if you want to update updates)
    • METHOD has to be REQUEST (*1)
    • Email sender does NOT need to be the same as ORGANIZER (Sidenote: It is however, not possible in Google Calendar to update an ORGANIZER)
    • ORGANIZER does NOT need to be listed as an ATTENDEE
    • Email recipient has to be an ATTENDEE
    • Also (as mentioned above), the ATTENDEE needs additional parameters, not just :mailto
    • STATUS does NOT need to be provided. EDIT: This is the case when sending invites to google calendar / chrome / mac, but the invite doesn't get a proper preview in other combinations it seems
    • Arguments that take several lines in the doc should be indented by one space on the next line
    • In iCalender objects generated by Google Calendar you may notice that lines that are too long are broken into several lines into the document, however this is not required (e.g. you can provide a description that is a very long string, just make sure it only takes one line or cut it in lines where every line is indented with one space)
    • Bonus Tip: Use same UID in original invite and update (this is actually not required BUT makes sure your historical test results remain unaffected...)
    • Bonus Tip 2: for easier testing, also change the SUMMARY and subject of your email each time

    Cleaned up example:

    BEGIN:VCALENDAR
    PRODID:-//YourCompany/AppName//EN
    VERSION:2.0
    CALSCALE:GREGORIAN
    METHOD:REQUEST
    BEGIN:VEVENT
    DTSTART:20180331T150000
    DTEND:20180331T160000
    DTSTAMP:20180331T150000 // make sure to populate this dynamically
    ORGANIZER;CN=organizer@gmail.com:mailto:organizer@gmail.com
    UID:BESTIDEVER123
    ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=
    TRUE;CN=Recipient Name;X-NUM-GUESTS=0:mailto:recipient@gmail.com
    CREATED:20180331T150000  // make sure to populate this dynamically
    DESCRIPTION:Best event evah
    LAST-MODIFIED:20180331T150000 // make sure to populate this dynamically
    LOCATION:
    SEQUENCE:0 // don't forget to increment this!!
    SUMMARY:A Wonderful Event
    TRANSP:OPAQUE
    END:VEVENT
    END:VCALENDAR
    

    (*1) The only question that I could not figure out is how to have a METHOD:PUBLISH that can be updated - I am trying to make a calendar publishing app that should NOT take replies. If anyone can figure that out I would be very grateful. :-)

提交回复
热议问题