在带有应用程序脚本的共享驱动器中查找文件
此代码在文件夹中搜索一些文件。它在我的驱动器上很好,但是我需要在公司中的共享文件夹中,并且没有获得文件名和ID。我已经阅读了有关{supportSalldrives:true}的信息,但是我不知道如何在代码中实现它(我什至不知道它是否是解决方案)。 在我的项目中启用了驱动器API和Driveactivity API。
var expFolder = carpetabasecs.searchFolders(searchFor);
while (expFolder.hasNext()) {
var expFolderDef = expFolder.next();
var expFolderId = expFolderDef.getId();
var mask = 'TXT';
var query = `title contains "${mask}" and trashed = false and "${expFolderId}" in parents`;
var findings = Drive.Files.list({ q: query }) || [];
var table = [['Archivos exportados', 'IDs'], ...findings.items.map(f => [f.title, f.id]).sort()];
sh.getRange(2,1,table.length,2).setValues(table);
谢谢
This code search for some files inside a folder. It work good on my drive, but I need it for a shared folder in my company and it does not get file names and ids. I've read about {supportsAllDrives: true} but I don't know how to implement it in the code (I don't even know if its the solution).
Drive API and DriveActivity API are enabled in my project.
var expFolder = carpetabasecs.searchFolders(searchFor);
while (expFolder.hasNext()) {
var expFolderDef = expFolder.next();
var expFolderId = expFolderDef.getId();
var mask = 'TXT';
var query = `title contains "${mask}" and trashed = false and "${expFolderId}" in parents`;
var findings = Drive.Files.list({ q: query }) || [];
var table = [['Archivos exportados', 'IDs'], ...findings.items.map(f => [f.title, f.id]).sort()];
sh.getRange(2,1,table.length,2).setValues(table);
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
最后,我正在使用此方法来过滤文件。它在共享的驱动器上很好地工作。
无论如何,我仍然有兴趣了解如何使用drive.files.list命令,underomainInAdminAccess和SupportAllDrives无法完成工作。我已经读到该命令是在高级驱动器服务中,API与驱动器API相同?因为我找不到云服务中的高级驱动器服务。
Finally I'm using this method to filter the files. It's working good on shared drives.
Anyway I'm still interested in understand how to use the Drive.Files.list command, useDomaininAdminAccess and supportAllDrives don't make the work. I've read that the command is in Advanced Drive Service, that API is the same as Drive API? Because I can't find Advanced Drive Service in Cloud Services.
你尝试过吗?
Did you try like this?
更改以下内容:
对此:
请记住,您正在使用驱动器v2(而不是v3)
文档
Change this:
To this:
Remember that you are using the Drive v2 (not v3)
Documentation