KEMBAR78
fix: Update Code.js to account for changes from Calendar API by kar320 · Pull Request #434 · googleworkspace/apps-script-samples · GitHub
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions solutions/automations/vacation-calendar/Code.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down