2017-07-16 430 views
0

每個文檔,文件和文件夾都通過我的Google雲端硬盤中的鏈接共享進行共享。是否有方法或腳本通過關閉鏈接共享來取消共享每個文件夾中的每個文件?提前致謝。 OPGoogle Drive鏈接取消共享

回答

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 = "[email protected]"; // <<<<< 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?

+0

謝謝你的回覆。這與我正在尋找的類似,但我需要禁用鏈接共享權限,而不是個人共享。有沒有辦法做到這一點?謝謝。 OP – OctopusProteins