如何使用 Google Drive API Javascript 列出特定文件夹中的更改

索尔·布尔戈斯

我正在使用 Changes:list API 来列出更改。

https://developers.google.com/drive/api/v3/reference/changes/list

但结果包括我驱动器中的所有文件夹。我想过滤特定文件夹的结果。在文档中,我没有看到像“Files:List”那样的“changes:list”参数“q”。

有没有办法通过 API 参数过滤结果?或者我是否需要使用我已经知道的“文件夹 ID”在我的代码中执行此操作?

这是我正在使用的代码:

var request = gapi.client.drive.changes.list({
        //The collection works by providing the current state of each item, if and only if the item has changed since a given point in time.
        //point in history to retrive changes, we can saved this to know if there are changes
        pageToken: '820167',

        
        //test parameters that are not working
        //q: "'12pDb31bRw7p3pfJoF_N6VncDqISSY1W4' in parents",
        //q: 'trashed=false and "'+ folderId +'" in parents',

        fields: '*',
        pageSize:  5,
        orderby:'title',
        maxResults: 50
      });

      request.execute(function (resp) {
        console.log(resp);
      });
玛丽

我可能会建议改用Drive Activity API,它可以让您查询文件夹中的更改。您需要指定参数ancestorName=items/${folderId}Drive Activity 还会让您更深入地了解所发生的实际活动。

驱动器更改资源非常少。它旨在快速查看整个驱动器/共享驱动器的变化。它增加的价值是能够为推送通知设置监视——这些可用于触发进一步的操作。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何在Google Drive API v3 PHP中的特定文件夹中列出文件

使用Google Drive API上传文件夹中的文件

如何在 google drive api 中复制文件夹?

如何使用Google Drive Javascript API更新Google Drive中的zip文件

如何使用Google的Python Drive Client API在Team Drive中创建文件夹?

如何使用Google Drive API和Python将文件上传到特定文件夹?

如何列出 Google Drive 根文件夹中的文件和文件夹

列出目录中ID不是Google Drive API v3和C#中特定值的文件夹

如何使用Google API在Team Drive中创建文件夹?

Google Drive API 不再用于列出文件夹中的文件

我想使用Google Drive API curl将文件上传到特定文件夹

使用Google Drive API下载文件夹

使用 PHP 创建文件夹 Google Drive API

如何使用Google Drive API上传文件?

如何通过 Javascript Google Drive API 登录特定的 Google Drive 帐户

将Google Drive API与Java结合使用,如何仅列出Drive Section / Folder中的文件

在Google Drive API中搜索文件或文件夹时如何获得面包屑?

如何不检测在 google drive changes api 中打开文件和文件夹

使用 Google Drive Java API 返回文件夹中的所有文件

使用.Net列出Google Drive V2中的所有文件和文件夹

使用 pydrive 或 google drive api 在 google drive 中复制文件

如何在Google Drive API中按路径查找文件夹ID?

如何在Google Drive Android API中获取已创建文件夹的DriveId

如何在Google Drive API中禁用文件夹的递归(Swift 5)

在 python 中通过 Google Drive API 使用 ID 搜索文件夹

未使用 Google Drive API 获取共享文件夹中的项目列表

Google Drive API搜索文件夹

是否可以使用Google Drive API列出Google Drive中指定目录中的文件?

如何使用带有 CORS 或 API 凭据的 javascript 共享来自 Google Drive 的 mp3 文件