使用 google 个文件列表,我如何才能只显示我拥有的文件夹而不是共享文件夹?

with google files list how can I only show my owned folder instead of shared ones?

我只想在使用以下代码时显示我拥有的文件,但实际上它列出了所有文件,包括与我共享的文件。请问我怎样才能防止这种情况发生

   gapi.client.drive.files
      .list({
        includeItemsFromAllDrives: false,
        supportsAllDrives: false,
        pageSize: 10,
        fields: 'nextPageToken, files(id, name, mimeType, modifiedTime)',
        q: searchTerm
      })

您应该使用的 search term 是所有者。特别是用户的电子邮件地址,您作为所有者的身份

'XXX@gmail.com' in owners

或者,如果您要查找当前经过身份验证的用户,请使用

'me' in owners

要查找文件夹,您可以使用以下内容,它主要检查文件夹的 MIME 类型。

mimeType = 'application/vnd.google-apps.folder'

然后将它们串在一起,你只需使用 and

例子

   gapi.client.drive.files
      .list({
        includeItemsFromAllDrives: false,
        supportsAllDrives: false,
        pageSize: 10,
        fields: 'nextPageToken, files(id, name, mimeType, modifiedTime)',
        q: ''me' in owners and mimeType = 'application/vnd.google-apps.folder''
      })

你需要修复我周围的 '' 我对 javascript 不是很有经验抱歉。