Reputation: 11108
So Google Apps Scripts allow you to getCalendarByID
, getCalendarsByName
and getDefaultCalendar
, which works great when you need to target a specific calendar. However, I was wondering if there's a way for me to get ALL the Calendars that is associated with the account?
I've tried getCalendarsByName()
, getCalendarsByName('')
and getCalendarsByName('*')
, none of which works.
Upvotes: 0
Views: 2881
Reputation: 57
This works for me:
function get_calendars() {
var calendars = CalendarApp.getAllCalendars();
for (var i = 0; i < calendars.length; i++) {
var calendar = calendars[i];
Logger.log(calendar.getName());
}
}
Upvotes: 2
Reputation: 46802
have you tried getAllCalendars()
? Get all Calendars subscribed to by this user
Upvotes: 5