Student Gradebook. Unable to complete script because of “Access denied: DriveApp”

前端 未结 3 1966
无人共我
无人共我 2021-01-15 18:30

My script takes 35 student names from the Sheet \'Studenti\'. Then finds the proper folder with their name (i.e. \'Smith Peter\'), removes old pdf document with old grades h

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-15 19:14

    I have the same problem with trashing files, that I don't own. I found that

    1. If you are on the list getEditors() or getViewers() I have the solution: Just revoke permission from yourself. file.revokePermissions(Session.getActiveUser()); and file will disappear.
    2. Example 1 doesn't work if file has set isShareableByEditors() - if it's "false", then you can't do anything.
    3. If you've added file to your drive which is publicly accessible for everyone with link, you can't revoke permissions, because you don't have one. app script return access denied. So, I thought that I can setTrashed(true). I was wrong. Google also return Access denied: DriveAp.

    I didn't find a way to remove unwanted files from my drive in case 2 and 3 thru apps script. But it's still possible by clicking on them and choosing option "Remove".

提交回复
热议问题