-
Notifications
You must be signed in to change notification settings - Fork 0
/
calendar.gs
32 lines (32 loc) · 1.05 KB
/
calendar.gs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function getCalEvents(cal, startTime, endTime){
var realStartDate = new Date(startTime);
var realEndDate = new Date(endTime);
try{
var events = cal.getEvents(new Date(startTime), new Date(endTime));
var returnEvents = events.map(function(event){
Logger.log(JSON.stringify(event));
var returnEvent = {
id: event.getId(),
calendarName : cal.getName(),
startTime: event.getStartTime().toString(),
endTime : event.getEndTime().toString(),
title : event.getTitle(),
description : event.getDescription(),
guestList : event.getGuestList(true).map(function(guest){
return {name : guest.getName(),
email : guest.getEmail(),
status: guest.getGuestStatus()
};
}),
creators : event.getCreators(),
dateCreated : event.getDateCreated.toString(),
location : event.getLocation()
}
return returnEvent;
});
return returnEvents;
}catch (error){
Logger.log(error);
throw error;
}
}