I'm iterating through a spreadsheet of events and modifying my calendar accordingly.
I can use setRecurrence
to create multi-day events, but I can't figure out how to remove the class and turn it back into a single-day event.
It's important to know because evidently applying setRecurrence
to an event more than once does not replace/redefine the existing recurrence, but keeps tacking additional classes onto it. This prevents simple workarounds, such as applying a recurrence of 0 days, etc.
I'm looking for the equivalent of event.removeRecurrence()
.
This code uses advanced Calendar service, you have to enable it in the script editor menu : ressources/advanced Google Services ***
EDIT
following your comment,
Please note that the ID used by the advanced calendar API is slightly different as it does not include the @google.com. You should simply remove this last part before using it.
Example :
Use some string methods to get the result we need :
Working example :
First create an event with a 5 days recurrence using calendarApp (so we are in your real condition) using
createEventRec()
Check on the calendar that the event is as expected
Then use
changeEvent()
and check the result