I am having a hard time finding a way to get the emails of all the partecipants in the next events on my calendar.
I only get the email of only one partecipant
The final idea should be to color code the calendar based on who is in the meetings.
Here's what I got so far
var today = new Date();
var nextweek = new Date();
nextweek.setDate(nextweek.getDate() + 7);
Logger.log(today + " " + nextweek);
var calendars = CalendarApp.getAllOwnedCalendars();
Logger.log("found number of calendars: " + calendars.length);
for (var i=0; i<calendars.length; i++) {
var calendar = calendars[i];
var events = calendar.getEvents(today, nextweek);
for (var j=0; j<events.length; j++) {
var e = events[j];
var title = e.getTitle();
var guestlist=events[j].getGuestList();
var details=guestlist[j].getEmail();
if (details == "example0@gmail.com") {
e.setColor(CalendarApp.EventColor.CYAN);
}
if (details == "example1@gmail.com") {
e.setColor(CalendarApp.EventColor.YELLOW);
}
if (details == 'example2@gmail.com') {
e.setColor(CalendarApp.EventColor.GREEN);
}
}
}
} ```