我正在尝试使用 List drive 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());
}
我在查询中设置 Q 参数 where foldername="salesDrive"
它给了我类似的错误
引起:com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request {
"code" : 400,
"errors" : [ {
"domain" : "global",
"location" : "q",
"locationType" : "parameter",
"message" : "Invalid Value",
"reason" : "invalid"
} ],
"message" : "Invalid Value"
}
如何设置此 q 参数以仅显示特定的共享驱动器详细信息?