Google Apps Script - link between script

Hey. My problem is this: I would like to create a small web page where you can create an event in Google Calendar, but with some limitations. In my case, this calendar could be edited by my roommates to reserve a washing machine. This reservation cannot overlap, and we all have a limited number of days when we can use it.
I created a private calendar , and I created a script that checks requests, and if everything is fine, add an event to the calendar. This script is executed as me(because only I have permission to edit this calendar). But I have a problem getting the information that the user executes the script (me or one of my flatmates). The Session class contains 2 getActiveUser () and getEffectiveUser () methods, but the active user does not work (I think because of the privacy protection policy). But if I create another script that runs as a user accessing the website , I can get the active user.
Does anyone know if it is possible in any way to establish a connection between these two scenarios embedded on the same site? I want to transfer the email of the active user from one script to another. Or maybe you know how best to solve, how to solve this problem?

Relationship Adam

+2
source share
2 answers

As you noticed, you need to install a script to run when the user accesses it to receive his email. Then, instead of directly accessing the calendar (which you obviously cannot), you can call another script published, but executed as yours, allowing anonymous access to receive this request from the script “view” and create calendar events for it.

After publishing this "background" script, get its url and use it when calling UrlfetchApp.fetchto it. Then pass the parameters as url parameters (or to the payload if you prefer to use postinstead get).

script ContentService, script.

+3

, , , . script -, script. , , , comon, !

0

Source: https://habr.com/ru/post/1524838/


All Articles