Google Calendar ignoring ICS UID when using “Add t

2019-08-22 04:30发布

问题:

Developing an app where applicants schedule interviews with our team members through a third party service. Periodically we make API calls to the third party for any recent changes, generate an ICS file then email that file to our team member so they can store it in their Google Calendar.

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Google Inc//Google Calendar 70.9054//EN
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20171001T180000Z
DTEND:20171001T190000Z
SUMMARY:Sample Event
UID:5179167a74d55b6fbaf6193026af14de@example.io
DTSTAMP:20171001T023000Z
ORGANIZER:noreply@example.io
SEQUENCE:0
END:VEVENT
END:VCALENDAR

The issue I'm having is that when the team member clicks the "Add to Calendar" link that Google Mail generates. It ignores the UID I generated, 5179167a74d55b6fbaf6193026af14de@example.io, and creates it's own: 20d19q1acurfub15pe94hb1b7s@google.com.

Because of this, when updates are made to the event the UID is not the same as Google is storing, therefore it creates a whole new event rather than updating the existing event. In the example below the event was moved 1 hour ahead:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Google Inc//Google Calendar 70.9054//EN
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20171001T190000Z
DTEND:20171001T200000Z
SUMMARY:Sample Event
UID:5179167a74d55b6fbaf6193026af14de@example.io
DTSTAMP:20171001T023224Z
ORGANIZER:noreply@example.io
SEQUENCE:1
END:VEVENT
END:VCALENDAR

So now there are two events for the same interview with two different xxx@google.com UIDs.

I have found that if I import the ICS file directly, instead of using the "Add to Calendar" link, then the UID is preserved as originally created and updating/cancelling works as expected. Since the process of importing events in Google Calendar isn't the easiest workflow and the large volume of events we're expecting, I'm hoping to retain the "Add to Calendar" method.

Any suggestions on what I'm doing wrong here?

回答1:

You are sending a meeting REQUEST without any ATTENDEE property. ATTENDEE is mandatory as per https://tools.ietf.org/html/rfc5546#section-3.2.2 This is the most likely cause of the calendar server being confused.