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 = ["user1@gmail.com", "user2@gmail.com"];
  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 = ["personal@gmail.com","user1@gmail.com", "user2@gmail.com"];

It will not send Google calendar invitation to:

personal@gmail.com

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 someoneelse@gmail.com with personal@gmail.com and allow personal@gmail.com to manage all calendar events.
    2. someoneelse@gmail.com creates a calendar event in that calendar.
    3. personal@gmail.com 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 personal@gmail.com

    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.