Search code examples
google-apps-scriptgoogle-calendar-apigoogle-app-invites

Google Invitation is not sent using Google apps script when I use my personal email address


Continuation to my previous question, following code snippet is proposed by @Tanaike to send Google calendar invitation email to multiple email addresses simultaneously:

function SendMultiple(calendarId, eventId) {
  var newGuests = ["[email protected]", "[email protected]"];
  Calendar.Events.patch({ attendees: newGuests.map(email => ({ email })) }, calendarId, eventId, { sendUpdates: "all" });
}

However, when I use my personal email address in the newGuests array, it does not send to it, for example:

 var newGuests = ["[email protected]","[email protected]", "[email protected]"];

It will not send Google calendar invitation to:

[email protected]

Is it because my email has edit access to the calendar while others do not have? or can we find a way to send emails to this personal email address as well, any guidance would be much appreciated.


Solution

  • I was able to get the same behavior using Google Apps Script as well as when using the Google Calendar Web UI by doing this:

    1. Share a calendar created by [email protected] with [email protected] and allow [email protected] to manage all calendar events.
    2. [email protected] creates a calendar event in that calendar.
    3. [email protected] updates the calendar event attendees and adds their own email (By either clicking the three-dot menu or using Google Apps Script).
    4. Email invites are only sent to all other emails besides the user [email protected]

    I could find this issue tracker entry where the same behavior was reported but it was confirmed to be an expected behavior: https://issuetracker.google.com/issues/235108773#comment6.

    Basically, Google is considering the actor of the Event Update request as an Organizer, this would explain why the invites are not sent in this specific scenario. You could create a Feature Request requesting for a feature to be able to send invitation emails to all attendees regardless of the using this link https://developers.google.com/calendar/api/support#developer_product_feedback.