Good afternoon!
I am having trouble accessing google Team Drive.
I need to create folders and upload files there from the local storage, and all this should be done by my application.
At the moment, I have learned to connect to my personal Google Drive and upload files there. My code for connecting to personal storage:
Drive service = new Drive.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential) //
.setApplicationName(APPLICATION_NAME).build();
// Print the names and IDs for up to 10 files.
FileList result = service.files().list().setPageSize(10).setFields("nextPageToken, files(id, name)").execute();
List<File> files = result.getFiles();
if (files == null || files.isEmpty()) {
System.out.println("No files found.");
} else {
System.out.println("Files:");
for (File file : files) {
System.out.printf("%s (%s)\n", file.getName(), file.getId());
}
}
Tell me, how can I connect to Google Team Drive in java and upload files there? Thank you:)