getGuestList() not fetching email

387 views
Skip to first unread message

Clínique Odontologia

unread,
Feb 5, 2021, 5:16:11 PM2/5/21
to google-apps-sc...@googlegroups.com
Hi! I´d like to get the guest list (email or any information would do).
When I log the variable, instead of the information, is it says "eventguest" My code:
function myFunction() {
  var syncCal = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(("Sync Calendar"))


var cal = CalendarApp.getCalendarById("example@gmail.com");
var events = cal.getEvents(new Date("2/2/2019 1:00 AM"), new Date("3/3/2022 11:59 PM"));
for(var i = 0;i<events.length;i++){
  var id = events[i].getId();
  var guestEmail = events[i].getGuestList()
  Logger.log(guestEmail)
}}

and theLogger.log

Scott Bennett

unread,
Feb 5, 2021, 5:19:12 PM2/5/21
to google-apps-sc...@googlegroups.com
Definitely not an expert. Do you need to iterate through the guest list?  

Scott Bennett


Sent from my iPhone 

On Feb 5, 2021, at 4:16 PM, Clínique Odontologia <clinique...@gmail.com> wrote:


Hi! I´d like to get the guest list (email or any information would do).
When I log the variable, instead of the information, is it says "eventguest" My code:
function myFunction() {
  var syncCal = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(("Sync Calendar"))


var cal = CalendarApp.getCalendarById("clinique...@gmail.com");
var events = cal.getEvents(new Date("2/2/2019 1:00 AM"), new Date("3/3/2022 11:59 PM"));
for(var i = 0;i<events.length;i++){
  var id = events[i].getId();
  var guestEmail = events[i].getGuestList()
  Logger.log(guestEmail)
}}

and theLogger.log
<Auto Generated Inline Image 1>

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/a805afff-3ecf-449b-ba11-fe36777161dbo%40googlegroups.com.
<Auto Generated Inline Image 1>

CBMServices Web

unread,
Feb 5, 2021, 5:54:37 PM2/5/21
to google-apps-sc...@googlegroups.com
The method getGuestList() returns an object which is EventGuest. To get the email of the guest, you need to use getEmail() method on the EventGuest object to get the email.

Check this page for details on what the EventGuest object contains and methods that you can use.

 Good luck.

 

On Fri, Feb 5, 2021 at 2:16 PM Clínique Odontologia <clinique...@gmail.com> wrote:
Hi! I´d like to get the guest list (email or any information would do).
When I log the variable, instead of the information, is it says "eventguest" My code:
function myFunction() {
  var syncCal = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(("Sync Calendar"))


var cal = CalendarApp.getCalendarById("clinique...@gmail.com");
var events = cal.getEvents(new Date("2/2/2019 1:00 AM"), new Date("3/3/2022 11:59 PM"));
for(var i = 0;i<events.length;i++){
  var id = events[i].getId();
  var guestEmail = events[i].getGuestList()
  Logger.log(guestEmail)
}}

and theLogger.log

--
Reply all
Reply to author
Forward
0 new messages