Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script getFiles()不是';t返回所有可用文件_Google Apps Script_Google Drive Api - Fatal编程技术网

Google apps script getFiles()不是';t返回所有可用文件

Google apps script getFiles()不是';t返回所有可用文件,google-apps-script,google-drive-api,Google Apps Script,Google Drive Api,这段代码应该可以从我的驱动器中找到我的所有文件,但我只收到7个文件中的5个-有人能帮忙吗 这是如何按照以下命令返回所有文件: 我不熟悉采用两个参数的DriveApp.getFiles版本-它们是输入参数吗?执行此代码时,它们有什么值?我正在尝试从驱动器中获取所有文件,以便搜索包含不带参数的文本。你能告诉我们关于这个循环没有显示或访问的文件的什么信息吗?代码不完整,另一方面,getFiles方法显然是错误的,所以googleapps脚本编辑器应该返回一个错误。请添加一个。是的,代码不完整。发现错误

这段代码应该可以从我的驱动器中找到我的所有文件,但我只收到7个文件中的5个-有人能帮忙吗

这是如何按照以下命令返回所有文件:


我不熟悉采用两个参数的
DriveApp.getFiles
版本-它们是输入参数吗?执行此代码时,它们有什么值?我正在尝试从驱动器中获取所有文件,以便搜索包含不带参数的文本。你能告诉我们关于这个循环没有显示或访问的文件的什么信息吗?代码不完整,另一方面,getFiles方法显然是错误的,所以googleapps脚本编辑器应该返回一个错误。请添加一个。是的,代码不完整。发现错误我正在获取值并将它们作为附件发送,代码在将它们作为电子邮件发送时冻结。问题已为我解决。我更改了方式。这不回答问题,至少对我而言,这是:为什么
DriveApp.getFiles()
不返回所有可用文件。在我的例子中,当我像您所指出的那样迭代时,我只计算了大约4900个文件,而文件的数量远远不止这些。
 var results = DriveApp.getFiles(start,max);

 while(results.hasNext()) {
  var result = results.next();
 }
 Logger.log("test");
// Log the name of every file in the user's Drive.
var files = DriveApp.getFiles();
while (files.hasNext()) {
  var file = files.next();
  Logger.log(file.getName());
}