Skip to content

Commit

Permalink
Fixes GioBonvi#181
Browse files Browse the repository at this point in the history
Hardcode the calendar ID "addressbook#[email protected]" as suggested by @sbrocket in the issue GioBonvi#181.
  • Loading branch information
vEnhance authored Dec 6, 2024
1 parent f021462 commit 14577e1
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions code.gs
Original file line number Diff line number Diff line change
Expand Up @@ -2184,17 +2184,8 @@ function validateSettings () {
log.add('Your user.notificationEmail setting is invalid!', Priority.FATAL_ERROR);
}

// Get the calendar ID from Google Calendar.
calendarId = CalendarApp.getAllCalendars().filter(function (cal) {
// All the valid calendar IDs contain this string.
return isIn('#[email protected]', cal.getId());
}).map(function (cal) { return cal.getId(); });

if (calendarId.length > 0) {
settings.user.calendarId = calendarId[0];
} else {
log.add('Could not find the birthday calendar! Please check that you have enabled it!', Priority.FATAL_ERROR);
}
// Hardcode the calendar ID for the address book
settings.user.calendarId = "addressbook#[email protected]";

try {
if (Calendar.Calendars.get(settings.user.calendarId) === null) {
Expand Down

0 comments on commit 14577e1

Please sign in to comment.