1

Is there a way to programmatically change the link sharing permissions for a file? I'm administering a Google Apps for Work account and I want to have a policy for every file in a folder named "Confidential" to have a certain set of permissions for Link Sharing, "Prevent editors from changing access and adding new people", and "Disable options to download, print, and copy for commenters and viewers".

It doesn't look like there's a way to do this in the Google Admin console, but is there a way for me to write a script that goes through periodically and "fix" every file's permissions?

2 Answers 2

1

First of all Google Drive File's uniqueness is in their ID which is given by Google when you upload, not in the filename like the desktop OS.

If you make sure that there is only one "Confidential" file, then you can list files from folder. Later , you can modify "File" properties by :

  1. To "Prevent editors from changing access and adding new people" :

    new File().setWritersCanShare(Boolean value)

  2. To "Disable options to download, print, and copy for commenters and viewers":

    new Labels().setRestricted(Boolean value)

Note that label can only be applied to files not folder. This is using Java, so you can can have a cron to accomplish this task.

0
1

With the latest version of Google Drive V3, you need to do the following to "Disable options to download, print, and copy for commenters and viewers":

file.setViewersCanCopyContent(false);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.