如何使用Java搜索Google Drive V3中的文件夹? [英] How to search the folder in the google drive V3 using java?

查看:72
本文介绍了如何使用Java搜索Google Drive V3中的文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Java搜索Google驱动器V3中的文件夹?

How to search the folder in the google drive V3 using java ?

       String queryParam1 ="mimeType='application/vnd.google-apps.folder' and 
         trashed=false";

      com.google.api.services.drive.Drive.Files.List qry =    drive.files().list().setQ(queryParam1).setCorpus("domain").setSpaces("drive");
      com.google.api.services.drive.model.FileList gLst = qry.execute();

此代码不返回任何内容.我有很多文件夹,但返回零结果.我可以搜索文件,但不能搜索文件夹.

This code returns nothing. I have many folders but returns zero result. I could search the files but not a folder .

推荐答案

在v2中,

In v2, Children: list is used to list a folder's children and to list all children of the root folder, use the alias root for the folderId value.

但是,在迁移到Google Drive API v3 中指出, Children Parents 集合已被删除.改为使用 files.list .

However, it's stated in Migrate to Google Drive API v3 that Children and Parents collections have been removed. Use files.list instead.

以此,尝试在 q 参数中添加 parents 属性.与此相关的 SO帖子可能会有所帮助.

With this, try adding parents property in your q parameter. This related SO post might help.

这篇关于如何使用Java搜索Google Drive V3中的文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆