Created
February 25, 2021 10:41
-
-
Save ssato/b55b5babec7cbb6212a3ef29100af4fe to your computer and use it in GitHub Desktop.
force_set_perm_of_files_in_google_drive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* | |
* https://developers.google.com/apps-script/reference/drive/access | |
* https://developers.google.com/apps-script/reference/drive/permission | |
*/ | |
function make_folder_readonly () { | |
const fid = "xxxxxxxxxxxxxx"; | |
const folder = DriveApp.getFolderById(fid); | |
const files = folder.getFiles(); | |
while (files.hasNext()) { | |
var file = files.next(); | |
file.setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW); | |
console.log(file.getName()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment