'Calendar API v3 - Handling Deleted Events For One-Way Sync
I'm using Google Calendar API v3 to work a one-way sync from another calendar system to a Google calendar, and wondering - how should I be treating deleted Google calendar events that are not deleted in the other calendar system?
The 'cancelled'/deleted Google calendar event I attempted to update contains the ICalUID value from an event in the other calendar system (where the event is not deleted). When I try to update/revive the 'cancelled' event I get a "403: Forbidden" response, and when I try to insert a new event using that ICalUID I receive a "duplicate" event error response.
Is there any way to revive the 'cancelled' event or clear its ICalUID? Or maybe a known gotchya hidden somewhere within this scenario that I missed?
I can re-create them using a different ICalUID, but I'm hoping someone else can offer some insight from their experience before I abandon the ICalUID. Thanks!
Solution 1:[1]
Based on the Events resource, you can't update a deleted Event. You can, however, update a cancelled Event. 'Events: update' will require the calendarId and eventId with the JSON object (updated status value) in the response body.
Solution 2:[2]
If anyone else is struggling with this, we were able to solve this by doing a couple of key things:
Creating events using iCalUID instead of id
Add events using google's calendar.events.import method rather than calendar.events.insert. This helped to avoid the "403: Forbidden" response
This worked for us, so hopefully it'll help someone else!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | adjuremods |
| Solution 2 | dantheman571 |
