1

I've enabled the Google Drive Advanced Services library into my App Script.

enter image description here

I'd like to use the library so I can write code like:

var permission = {
  type: 'user',
  role: 'writer',
  value: email
};

var new_permission = Drive.Permissions.insert(permission, fileId);

But how do I get that library or script to run as a Service Account so I can do things that require Domain Wide Delegation?

Thanks!

jadent
  • 3,674
  • 5
  • 27
  • 32

1 Answers1

1

So this isn't a full answer, but it was too big to fit in a comment:
I've written some tools for my personal use that I've put on my github. The first is a library to request tokens for domain members.

https://github.com/Spencer-Easton/Apps-Script-GSApp-Library

There is no built service that can use these tokens so you have to use the REST API for the service you need to call. It looks like you need the Drive API. I did put together a Drive v3 library.

https://github.com/Spencer-Easton/Apps-Script-Drive-v3-Library

I even have a specific library for working in domain users files (Drive V2):
https://github.com/Spencer-Easton/Apps-Script-Drive-Service-Account-Library

Spencer Easton
  • 5,642
  • 1
  • 16
  • 25