Google云端硬盘未在文件夹中列出文件

当我提供文件夹ID时,Google云端硬盘不会列出文件夹中的文件,也不会在我提供mime类型时列出文件。 它适用于具有空查询的根文件夹中的文件。 如何列出文件夹中的文件?

码:

public ArrayList getDriveList(String folder, String folderId) throws IOException { // Create a new authorized API client HttpTransport httpTransport = new NetHttpTransport(); JsonFactory jsonFactory = new JacksonFactory(); Credential credential = Utils.getCredential(); Drive service = new Drive.Builder(httpTransport, jsonFactory, credential) .setApplicationName("SDM Mailer App") .build(); ArrayList result = new ArrayList(); // String query = ""; String query = "'"+folderId+"' in parents"; // String query = "mimeType = 'application/vnd.ms-excel'"; // String query = "'"+folderId+"' in parents and mimeType = 'application/vnd.ms-excel'"; log.info("Finding files with query: " + query); Drive.Files.List request = service.files().list().setQ(query); do { try { FileList files = request.execute(); result.addAll(files.getItems()); request.setPageToken(files.getNextPageToken()); } catch (IOException e) { System.err.println("An error occurred: " + e); request.setPageToken(null); } } while (request.getPageToken() != null && request.getPageToken().length() > 0); log.info("Found # results: " + result.size()); ArrayList resultPlain = new ArrayList(); for (File f: result) { resultPlain.add(f.getTitle()); } return resultPlain; } // driveList 

日志:

 INFO: Finding files with query: '0B72jLeZWY3rsQllNMWhCQWhtLWc' in parents Oct 04, 2013 8:50:42 PM com.example.server.SDMServiceImpl getDriveList INFO: Found # results: 0 

或者使用空查询,根文件夹:

 INFO: Finding files with query: Oct 04, 2013 9:20:05 PM com.example.server.SDMServiceImpl getDriveList INFO: Found # results: 2 

驱动文件:

Imgur

参考文件:

https://google-developers.appspot.com/drive/search-parameters

jar:

谷歌的API服务驱动-V2-rev102-1.16.0-rc.jar