0

My goal is to create a script which users can run from within a shared Sheets file. This script is meant to create a calendar for each user and share it back to me, so I can later push events using this new calendar ID. If possible, I'd like to also setup the all-day-notifications during this script run. Here's my current code:

function create_calendar_share_back_to_me {
 var calendar = CalendarApp.createCalendar('test1', {
  summary: 'A calendar to store all CRM automated events',
});
Logger.log('Created the calendar "%s", with the ID "%s".',
    calendar.getName(), calendar.getId()); 
}

As you can see. I'm stuck on the sharing part :) I'll of course run this on my machine first in order to provide permissions. Will that be enough to allow all other users in the domain to run this script and create this calendar under their own user (not my user)? Thanks

user13708028
  • 315
  • 3
  • 13
  • did you tried applying ACL rules ? [here's the link check out](https://developers.google.com/calendar/v3/reference/acl/insert) – Parse Shyam Jun 22 '20 at 15:11
  • Thanks @parseshyam ! I'll surely check it out. Do you happen to know if there're similar rules for creating contacts on behalf of other users? – user13708028 Jun 22 '20 at 17:25
  • `I'll of course run this on my machine first in order to provide permissions` not sure I follow you here. If you do this, **you** will authorize the script, but the other users will have to authorize it too when they try to run it. How is this script supposed to run? Directly, from the script editor, or through some kind of UI element, like a Menu? – Iamblichus Jun 23 '20 at 07:47
  • I wanted to run with a menu item but decided against it at the end. Thanks for all of your answers. – user13708028 Jun 23 '20 at 17:30

0 Answers0