From db50f4859b349bbc57ef1a95ad06ed72d47fba68 Mon Sep 17 00:00:00 2001 From: Kara <62033369+kar320@users.noreply.github.com> Date: Thu, 7 Dec 2023 09:50:16 -0700 Subject: [PATCH] fix: Update Code.js to account for changes from Calendar API Updates the most recent version of the Vacation Calendar solution for Apps Script. --- solutions/automations/vacation-calendar/Code.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/solutions/automations/vacation-calendar/Code.js b/solutions/automations/vacation-calendar/Code.js index d00a2bee6..ef0078a20 100644 --- a/solutions/automations/vacation-calendar/Code.js +++ b/solutions/automations/vacation-calendar/Code.js @@ -97,6 +97,15 @@ function importEvent(username, event) { id: TEAM_CALENDAR_ID, }; event.attendees = []; + + // If the event is not of type 'default', it can't be imported, so it needs + // to be changed. + if (event.eventType != 'default') { + event.eventType = 'default'; + delete event.outOfOfficeProperties; + delete event.focusTimeProperties; + } + console.log('Importing: %s', event.summary); try { Calendar.Events.import(event, TEAM_CALENDAR_ID);