Martin V.
Martin V.

Reputation: 3710

Google apps script : Time triggers and user context

i would like to know if time triggers remembers 'user context'. My google app script looks into users google drive folder and i wonder if it would be possible to create time trigger which would check e.g. every hour content of google drive.

I am running script with this configuration :

Execute the app as : "User accessing the web app"

and time trigger :

var later = new Date(new Date().getTime() + 1 * 60 * 60 * 1000); 
ScriptApp.newTrigger("timeDrivenMethod").timeBased().at(later).create();

Upvotes: 1

Views: 1144

Answers (1)

Serge insas
Serge insas

Reputation: 46794

As mentioned in the documentation 'installable triggers have some similarities to simple triggers, but also these differences:

They run as the user who installed the trigger, not as the user triggering the event.'

So your app will ask for authorization on this and the triggered function will be executed as the user that created the trigger, in this case as the user running the webapp (since the script creates it under authority of the active user as you defined it in the deploy parameters).

Upvotes: 3

Related Questions