Add Multiple Guest to Calendar Event from AppScript

708 views
Skip to first unread message

Nabil Hassan

unread,
Sep 1, 2022, 10:11:09 AM9/1/22
to google-apps-sc...@googlegroups.com
Hi All,

I'm able to add an event to someone's calendar but I'm unable to add multiple email addresses.

Here is the snippet of the code:

var myObject =
{
location: link[0][0],
guests: primaryUser[0][0],
sendInvites: true
};

CalendarApp.getDefaultCalendar().createEvent(eventName+' - '+topicName, startDateTime,endDateTime,myObject);

Now, if I add another email address in the code shown below:

var myObject =
{
location: link[0][0],
guests: primaryUser[0][0],secondaryUser[0][0],
sendInvites: true
};

CalendarApp.getDefaultCalendar().createEvent(eventName+' - '+topicName, startDateTime,endDateTime,myObject);

This just adds only the primary user to the calendar event.

Please help

Regards,
Nabil

Ben Ronkin

unread,
Sep 1, 2022, 11:49:44 AM9/1/22
to Google Apps Script Community
Per the documentation,  guests needs to be one value of a type of string containing comma-separated email addresses. Your code is passing two variables.
Reply all
Reply to author
Forward
0 new messages