I received this error when attempting to run the sample Drive AppScript, even after authorizing the AppScript to access Drive. I have also tried hard-coding a folder ID and am receiving the same error.
The code is as follows:
function listFilesInFolder(id) {
var folder = DriveApp.getFolderById(id);
var contents = folder.getFiles();
var file;
var name;
while(contents.hasNext()) {
file = contents.next();
name = file.getName();
Logger.log(name);
}
};
In the Admin Console for you or your domain (admin.google.com) . section Drive - General settings - Enable "Allow users to install Google Drive Apps"
I was able to execute the script, after authentication, without any problems. Most probably, the DriveApp
isn't activated in the Admin Console for you or your domain.
The following issue might be of interest (read comment #5), if the problem persist: Issue 4006
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With