0

I'm having an issue automating the adding of members to Google Calendars.

My function is:

function addToCalendar(email, calendar) {
    // Create a user with read/write access to calendar
    var resource = {
        scope: {
            type: 'user',
            value: email
        },
        role: 'writer'
    };

    Calendar.Acl.insert(resource, calendar);
}

This function works with Gmail accounts, but does not work correctly with non-Gmail accounts. Non-Gmail accounts are still listed as added within the calendar, but cannot access the calendar.

I think the issue stems from Google Calendar requiring a Gmail account. When you manually try to add a user, you get this prompt:

Screenshot:

enter image description here

Is there any way to replicate this invite with Google Apps Script, or a way to get around this issue?

Any help is appreciated.

Thanks

curious
  • 1,504
  • 5
  • 18
  • 32
  • I'm not sure if there is a workaround or allowed (listed but cannot access the Calendar because they are non gmail account). But try adding this to feature request, you may get a better/concrete answer. Apologies sendNotifications is for events and not for ACL function. – Mr.Rebot Sep 17 '17 at 23:49

1 Answers1

0

As per my experience you are using ACL Rule of google calendar API.

So, your function code is right but make sure one thing. you are giving access control of your google calendar by using this function to other user. Therefore it is necessary that the other user must have google account. Because when give this access to other user your shared calendar will be displayed in his Calendar UI.

enter image description here

Here is green highlighted calendars in screen shot are shared and it looks like this.

1) For the calendar google account is required. 2) For the event you can add attendees to gmail or non-gmail account.

Priyank
  • 224
  • 2
  • 14
  • Thanks Priyank. My issue is that the web interface will provide an option to invite non-Gmail accounts. The user can then create an account which is then automatically added to the calendar. I want to be able to replicate this. It seems like my only option is to screen for non-Gmail accounts (which is not obvious due to GSuite accounts) and tell those users to provide a Gmail account. – zomfg_zombie Sep 20 '17 at 01:01