是否可以使用 Google Apps 脚本在 Google 云端硬盘中搜索文档和文件夹?
Google 已经取消了自己的文档/驱动器搜索小工具,因为它似乎依赖于 iGoogle,并且 Google Enterprise 支持人员也承认了这一点。
谢谢
最佳答案
我认为您正在寻找 SearchFile和 SearchFolder DriveApp 的。 完整的参数列表可在 Google Drive SDK documentation 中找到。
我已经运行了一些测试,似乎不可能像从 Google Drive API 调用搜索功能那样进行 1 次搜索并获取文件和文件夹。
这里的代码列出了标题中包含 2013 的文件和文件夹
function myFunction() {
var searchFor ='title contains "2013"';
var names =[];
var files = DriveApp.searchFiles(searchFor);
while (files.hasNext()) {
var file = files.next();
names.push(file.getName());
}
var folders = DriveApp.searchFolders(searchFor);
while (folders.hasNext()) {
var file = folders.next();
names.push(file.getName());
}
for (var i=0;i<names.length;i++){
Logger.log(names[i]);
}
}
关于google-apps-script - 用于搜索 Google 云端硬盘的 Google Apps 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19722229/