在 Google Drive 中,可以搜索“不属于我”的文件。
我需要从 Google Apps 脚本访问它。
我已经尝试过 DocsList.find("Not 'me' in owner");这似乎是在驱动器 API 中执行此操作的方法,但没有成功(实际上这使我将文件作为所有者。)我还用我的电子邮件地址替换了我,带引号和不带引号,但再次没有成功。
有谁知道这是否可行(除了通过迭代所有文件并手动检查 getOwner().getEmail() 之外,考虑到该特定用户拥有的大量文件,这将花费太长时间。)
最佳答案
我认为到目前为止更新的答案是使用 DriveApp.searchFiles(params) ( https://developers.google.com/apps-script/reference/drive/drive-app#searchFiles(String) )。
代码是这样的:
// Log the name of every file in the user's Drive that shared with me
var files = DriveApp.searchFiles('sharedWithMe');
while (files.hasNext()) {
var file = files.next();
Logger.log(file.getName());
}
关于google-apps-script - 如何在 Google 应用程序脚本中查找不属于我的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15944544/