How can I send an invitation to the guest by Googl

2019-07-13 21:19发布

问题:

I am trying to add a guest to a Calendar event by Google Apps Script and to send an invitation as soon as my script add a guest. But I can't find a method to send an email invitation to the guest.

var events = calendar.getEvents(start_date, end_date)
event.addGuest('guest_email@gmail.com');

Is there any way to send an invitation to the guest from Apps Script?

I rewrote with Advanced Google Services but still the guest I have added can't get invitation email.

var body = {
  'sendNotification': true,
  'attendees': attendees
};

var ret = Calendar.Events.patch(body, calendarId, eventId);

回答1:

You can with Calendar in Advanced Google Services, for example:

var event = Calendar.Events.get(calendarId, eventId);
Calendar.Events.patch(event, calendarId, eventId, {sendNotifications: true});

Sets the sending of notifications to true

See the documentation on Calendar in the Advanced Google Services.