每个文档,文件和文件夹都通过我的Google云端硬盘中的链接共享进行共享。有没有办法或脚本通过关闭链接共享来取消共享每个文件夹中的每个文件?提前致谢。 OP
答案 0 :(得分:0)
您可以在下方试用此谷歌应用脚本代码,因为没有可以关闭全局共享的链接:
// create a Google Document
// Tools / Script Editor
// paste this in
// update line 13 and save
// hit play to run. you may have to run several times as the script will die after 5 or 6 minutes.
function findSharedFolders() {
// https://developers.google.com/apps-script/reference/drive/drive-app
// https://developers.google.com/drive/web/search-parameters
// http://stackoverflow.com/questions/21227771/how-do-i-script-google-drive-to-unshare-all-subfolders-and-files-given-a-folder
// https://productforums.google.com/forum/#!topic/drive/p3LZQnRNB24
var email = "unwanted-address@gmail.com"; // <<<<< INSERT THE UNDESIRED EMAIL ADDRESS HERE
var body = DocumentApp.getActiveDocument().getBody();
body.appendParagraph(email).setHeading(DocumentApp.ParagraphHeading.HEADING1);
var folders = DriveApp.searchFolders("'"+email+"' in writers"); while (folders.hasNext()) unshare_(folders.next(), body, email);
var files = DriveApp.searchFiles( "'"+email+"' in writers"); while ( files.hasNext()) unshare_( files.next(), body, email);
}
function unshare_(file, body, email) {
// Logger.log(file.getName());
var para = body.appendParagraph(file.getName());
try { file.removeEditor(email); }
catch (e) { para.setLinkUrl(file.getUrl()); para.appendText(" (" + e + ")"); }
}
来源:How do I script Google Drive to unshare all subfolders and files given a folder ID?