为什么此示例 AppScript 返回错误:“访问被拒绝:DriveApp?" [英] Why is this sample AppScript returning error: "Access Denied: DriveApp?"

查看:27
本文介绍了为什么此示例 AppScript 返回错误:“访问被拒绝:DriveApp?"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试运行示例 Drive AppScript 时收到此错误,即使在授权 AppScript 访问 Drive 之后也是如此.我也尝试硬编码文件夹 ID 并收到相同的错误.

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.

代码如下:

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);
  }
};

推荐答案

我能够执行脚本,经过身份验证,没有任何问题.很可能,DriveApp 没有在您或您的域的管理控制台中激活.

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.

如果问题仍然存在,可能会对以下问题感兴趣(阅读评论 #5):问题 4006

The following issue might be of interest (read comment #5), if the problem persist: Issue 4006

这篇关于为什么此示例 AppScript 返回错误:“访问被拒绝:DriveApp?"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆