I have an app with the following scenario:
- user creates a recurring event in google calendar in my app (via google calendar API v3)
- they change time of one of the instances (which creates exception instance - 'exception' in a good way)
- now they want to extend that recurring event and they change either count or end date of the master event
The problem is that all the exceptions disappears after that last step (calendar UI seem to handle that, but if done via the API the exceptions are gone). I've noticed however that outlook manages that case just fine via their API.
Is there any simple way of preserving the exceptions in this scenario in google calendar via API?
I've also noticed that if I try to further update one of the original exceptions after the master is updated, that gives error (an 'exception' in a bad way) and points that the instance event is marked as deleted hence can't be updated ('get' still returns it). In this case it created a new instance event with a new id in place of the original one.
UPDATE
A pseudo code to update the master event would look something like this:
let originalMastEvent = {
id:"google_generated_master_event_id",
...
recurrence: [ 'RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE,SA;COUNT=6' ],
...
}
//change the count from 6 to 10, the rest stays the same:
let newMastEvent = {
id:"google_generated_master_event_id",
summary: 'Summary',
start: { dateTime: '2020-06-24T01:00:00+02:00', timeZone: 'UTC' },
end: { dateTime: '2020-06-24T02:00:00+02:00', timeZone: 'UTC' },
recurrence: [ 'RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE,SA;COUNT=10' ],
sendUpdates: 'all',
attendees:[ { email: '[email protected]'} ]
}
const {google} = require('googleapis/build/src/index'); //I'm on node.js
let auth = {...} //setup google api oauth obj
let calendar = await google.calendar({version: 'v3', auth});
let res = await calendar.events.update({
calendarId: 'primary',
eventId: newMastEvent.id,
resource: newMastEvent,
sendUpdates: newMastEvent.sendUpdates
})