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

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

问题描述

尝试运行示例Drive AppScript时,即使授权AppScript访问云端硬盘后,我也收到此错误。我也尝试硬编码文件夹ID,并收到相同的错误。

代码如下:

 函数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



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

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

解决方案

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

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

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