列出来自Google驱动器的所有共享驱动器

问题描述

我正在尝试使用列出驱动器java方法列出googledrive中的所有共享驱动器。 这是我的代码。

public static void getDriveId(String folderName,String oauthToken) throws Exception {
            DriveList list ;
            String pageToken = null;
            GoogleCredential credential = new GoogleCredential(); 
            credential.setAccessToken(oauthToken);
            try {
                _driveService = new Drive.Builder(GoogleNetHttpTransport.newTrustedTransport(),JacksonFactory.getDefaultInstance(),credential).setApplicationName(appName).build();
            } catch (GeneralSecurityException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            list = _driveService.drives().list().setQ(folderName).setFields("nextPageToken,drives(id,name)")
                 .execute();
        System.out.println(list.toString());
        }

我在文件夹名=“ salesDrive”的查询中设置Q参数

它给我类似的错误

原因:com.google.api.client.googleapis.json.GoogleJsonResponseException:400错误的请求 {

  "code" : 400,"errors" : [ {
    "domain" : "global","location" : "q","locationType" : "parameter","message" : "Invalid Value","reason" : "invalid"
  } ],"message" : "Invalid Value"
}

如何设置此q参数以仅显示特定的共享驱动器详细信息?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)