问题
how do i get .getStartTime to work?
i'm using the CalendarEvent class, and .getStartTime is listed under this class (https://developers.google.com/apps-script/reference/calendar/calendar-event#getStartTime())
but when i try to run the following code, i get TypeError: Cannot find function getStartTime in object CalendarEvent.
function test() {
var TA =CalendarApp.getCalendarsByName("CalendarName")[0].getEvents(startDt, endDt);
var starting = TA.getStartTime();
Logger.log(starting);
return;
};
what am i doing wrong? i can't figure it out, all the tutorials i found online indicates that this should work.
回答1:
Looking at getEvents(Date,Date) it returns CalendarEvent[] .
So , you're trying to call a method on an entire array, instead of a particular CalendarEvent object.
Simply use TA[0].getStartTime()
or whichever event you'd like.
来源:https://stackoverflow.com/questions/40489432/getstarttime-not-a-function