Is it possible to get more than 1000 files from Google Drive Api using batch request and nextPageToken in Java ? Or maybe there is another solution to get large amount of files without nextPageToken using batch request in Java? Right now I'm getting only 460 files.
void prepareDataForGrid(final String rootFileName, UI ui) throws IOException {
driveService = googleDriveUtils.getDriveService(ui);
JsonBatchCallback<FileList> callback = new JsonBatchCallback<FileList>() {
@Override
public void onSuccess(FileList fileList, HttpHeaders httpHeaders) throws IOException {
files = fileList.getFiles(); // get only 460 files
}
@Override
public void onFailure(GoogleJsonError googleJsonError, HttpHeaders httpHeaders) throws IOException {
throw new IOException();
}
};
var batch = driveService.batch();
driveService.files().list()
.setQ("trashed = false")
.setSpaces("drive")
.setFields("nextPageToken, files(name, id, size, parents, modifiedTime, mimeType, webViewLink, createdTime)")
.setPageSize(1000)
.setOrderBy("name")
.queue(batch, callback);
batch.execute();
}
