google apps script - CalendarApp.getAllCalendars() returns array of nulls -
I'm calling CalendarApp.getAllCalendar () on the server via call to client
< Code> / * - server code - * / function getCalendar () {return CalendarApp.getAllCalendar (); } / * - * / / * - Client code - * / google.script.run.withSuccessHandler (getCalendarsHandler) .getCalendar (); GetCalendarHandler = function (cals) {console.log (JSON.stringify (cals)); }; Console show ... [empty, empty, empty, empty, null, empty, null, null, null, null, null, null, null, null, null, empty, blank]getCalendarsHandler Receives an array of (i have too many calendars) but in that array, each element is zero, can someone tell me what I am doing wrong?
Thank you
Later on that day .....
On the further investigation it seems that I must first construct the structure on the server I was expecting something similar to the gapi.client.calendar.calendarList.list (); But it seems that I have to build my own - like something ....
function getCalendar () {var cal, i, resp; Resp = []; Calories = CalendarApp.getAllCalendars (); (I = 0; i & lt; cal.length; i ++) {resp [i] = {"name": cal [i] .getName (), "id": cal [i] .getId (). ..}} return resp; }
later that day .....
On further investigation it seems that I have to build the structure on the server before passing the client. I was expecting something similar to gapi.client.calendar.calendarList.list (); But it seems that I have to build my own - like something ....
function getCalendar () {var cal, i, resp; Resp = []; Calories = CalendarApp.getAllCalendars (); (I = 0; i & lt; cal.length; i ++) {resp [i] = {"name": cal [i] .getName (), "id": cal [i] .getId (). ..}} return resp; }
Comments
Post a Comment