observer50
observer50

Reputation: 1

How to specify list of individual users to have access to a particular file in Google app scripts?

I have a Google app script that builds a set of PDF files. For each of these files, I want to assign a variable list of users to have access. I don't know exactly how to do this.

The code line doc.setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW) is my starting point. I can replace ANYONE_WITH_LINK with PRIVATE, but then I am not sure how to specify a list of users that will have access. Easily done interactively, but I need to do this in the script. Any ideas? Thanks in advance for any insights.

Upvotes: 0

Views: 30

Answers (1)

deltab
deltab

Reputation: 2556

Call the methods addCommenter, addEditor, and addViewer, as appropriate.

Upvotes: -1

Related Questions