Google Apps script event EventGuest does not have

2019-08-15 19:28发布

问题:

Grabbing google calander events into drive sheets worked like a charm with some copy paste code...

But my attempts at extracting event guests from Google calendar into a spreadsheet met with little success. See screenshot. Here's the code.

function getEmailsFromArray(guestsArray){
var guestEmails = []
for (var i=1;i<guestsArray.length;i++) {
  guestEmails.push(i.getEmail()) // i does not have getEmail()
}
return guestsArray; }

And this is called as a lamda(?) when preparing the data inserted into

 getEmailsFromArray(events[i].getGuestList())

Here's the doc for getGuestList()

Is EventGuest not an object with functions but a string? Am I perhaps not stepping through the array properly? Should I cry uncle?

回答1:

you have a few syntax issues, try this...

function getEmailsFromArray(guestsArray){
var guestEmails = [];
for (var i=0;i<guestsArray.length;i++) {
  guestEmails.push(guestsArray[i].getEmail());
}
return guestEmails; }