#javascript
Вопрос:
Я попытался удалить все файлы на своем Google диске с помощью этого кода (с помощью script.google.com):
function processAllFiles() {
// we look for the continuation token from the UserProperties
// this is useful as the script may take more that 5 minutes
// (exceed execution time)
var continuationToken = UserProperties.getProperty('DELETE_ALL_FILES_CONTINUATION_TOKEN');
if (continuationToken == null) {
// firt time execution, get all files from drive
var files = DriveApp.getFiles();
// get the token and store it in a user property
var continuationToken = files.getContinuationToken();
UserProperties.setProperty('DELETE_ALL_FILES_CONTINUATION_TOKEN', continuationToken);
} else {
// we continue to execute (and move everything to trash)
var files = DriveApp.continueFileIterator(continuationToken);
}
while (files.hasNext()) {
var file = files.next();
file.setTrashed(true);
Logger.log(file.getName());
}
// finish processing delete the token
UserProperties.deleteProperty('DELETE_ALL_FILES_CONTINUATION_TOKEN');
}
И я получил следующую ошибку:
Исключение ошибки: Отказано в доступе: DriveApp. processAllFiles @ Code.gs:20
Как я могу это исправить? Я попытался создать новое развертывание и подтвердить все необходимые разрешения.