2

我的应用程序基于具有已知根文件夹(例如“theFolder”)的树结构。
我能够检索名称为 <theFolder> 的所有文件夹:

gapi.client.request(
    {
    'path': '/drive/v2/files',
    'method': 'GET',
    'params': {
        q : "title='"+theFolder+"' and mimeType='application/vnd.google-apps.folder'",
        fields: "items(description,id,modifiedDate,parents/id,title)"
        },
    callback: theCallback
    });

但是,由于我只想要根文件夹(如果有的话),我徒劳地尝试添加一些标准:

  • and parents.isRoot
  • and parents.isRoot=true
  • and parents/isRoot=true
  • and (isRoot in parents)

我知道这与在 Drive SDK 上按文件夹获取文件列表有关,更普遍的是:“如何在子字段上设置标准?”

4

1 回答 1

2

您应该能够检查根文件夹是否在您要查找的文件夹的父文件夹中。为此,您可以使用该文件夹的“根”别名。

在您的搜索查询中试试这个:

'root' in parents
于 2012-07-19T12:40:57.287 回答