How to list all emails a Google calendar was shared with?
I would like to get all emails a google Calendar was shared with.
It seems to me that Calendar.CalendarList.list will not give me required info
/**
* Lists the calendars shown in the user's calendar list.
*/
function listCalendars() {
var calendars;
var pageToken;
do {
calendars = Calendar.CalendarList.list({
maxResults: 100,
pageToken: pageToken
});
if (calendars.items && calendars.items.length > 0) {
for (var i = 0; i < calendars.items.length; i++) {
var calendar = calendars.items[i];
Logger.log('%s (ID: %s)', calendar.summary, calendar.id);
}
} else {
Logger.log('No calendars found.');
}
pageToken = calendars.nextPageToken;
} while (pageToken);
}
Calendar.Acl.get(calId, "user:"+user) looks promising but I do not know how go get the info I want. Someone could help?
Suggestion
Perhaps you can try this sample script below that was derived from this similar post.
Sample Script
function aclTest(){
calendarId = 'Calendar_ID';
calendars_acl_list = Calendar.Acl.list(calendarId);
for (var i = 0; i < calendars_acl_list.items.length; i++) {
var info = calendars_acl_list.items[i];
if(info.role != "owner" && !info.id.includes("domain")){
Logger.log(info.id);
}
}
}
Sample Test:
- Sample Test Calendar
- Apps Script result: