如何在Google文件夹中查询根文件夹(Google Drive SDK for iPhone)中已知名称的文件夹的ID?

时间:2022-11-20 07:26:35

With query

随着查询

GTLQueryDrive *queryFilesList = [GTLQueryDrive queryForChildrenListWithFolderId:@"root"];

GTLQueryDrive * queryFilesList = [GTLQueryDrive queryForChildrenListWithFolderId:@“root”];

I get everything in root folder: files and folders. Sure, I can look for folder in GTLDriveChildList returned. But root folder can have thousands items, and I need only one of them. I tried narrow search. Comments in GTLQueryDrive.h say it's possible. I've tried

queryFilesList.q = @"mimeType='application/vnd.google-apps.folder'";

我得到根文件夹中的所有内容:文件和文件夹。当然,我可以在GTLDriveChildList中查找返回的文件夹。但根文件夹可以有数千个项目,我只需要其中一个。我试过窄搜索。 GTLQueryDrive.h中的评论说它是可能的。我试过queryFilesList.q = @“mimeType ='application / vnd.google-apps.folder'”;

to query only folders or

queryFilesList.q = [NSString stringWithFormat:@"title='%@'", folderName];

to query all items by name. Both queries return empty lists. Double checked: folder I look for really exists.

仅查询文件夹或queryFilesList.q = [NSString stringWithFormat:@“title ='%@'”,folderName];按名称查询所有项目。两个查询都返回空列表。双重检查:我寻找的文件夹确实存在。

I've tried

我试过了

GTLQueryDrive *queryFilesList = [GTLQueryDrive queryForFilesList];

It works well with

它适用于

queryFilesList.q =  @"mimeType='audio/x-aiff'";

But returns empty list if I try to query only folders with

但如果我尝试仅查询文件夹,则返回空列表

queryFilesList.q =  @"mimeType='application/vnd.google-apps.folder'";

What am I doing wrong?

我究竟做错了什么?

1 个解决方案

#1


7  

I am selfish idiot!

我是自私的白痴!

GTLQueryDrive *queryFilesList = [GTLQueryDrive queryForChildrenListWithFolderId:@"root"];
queryFilesList.q = @"mimeType='application/vnd.google-apps.folder'";

works just fine, but it sees ONLY folders created with this app! That was my problem. To be exact you may use this query:

工作得很好,但它只看到用这个应用程序创建的文件夹!那是我的问题。确切地说,您可以使用此查询:

queryFilesList.q = @"mimeType='application/vnd.google-apps.folder' and 'root' in parents and trashed=false";

trashed=false is important if you don't want trashed items to be found.

如果您不希望找到已删除的项目,则trashed = false非常重要。

#1


7  

I am selfish idiot!

我是自私的白痴!

GTLQueryDrive *queryFilesList = [GTLQueryDrive queryForChildrenListWithFolderId:@"root"];
queryFilesList.q = @"mimeType='application/vnd.google-apps.folder'";

works just fine, but it sees ONLY folders created with this app! That was my problem. To be exact you may use this query:

工作得很好,但它只看到用这个应用程序创建的文件夹!那是我的问题。确切地说,您可以使用此查询:

queryFilesList.q = @"mimeType='application/vnd.google-apps.folder' and 'root' in parents and trashed=false";

trashed=false is important if you don't want trashed items to be found.

如果您不希望找到已删除的项目,则trashed = false非常重要。