Reputation: 718
I want to list all the document from google domain.I have tried the as per mention in google documentation : https://developers.google.com/drive/v2/reference/files/list#examples
I have created service with as follow :
HttpTransport httpTransport = new NetHttpTransport();
JacksonFactory jsonFactory = new JacksonFactory();
GoogleCredential credential = new GoogleCredential.Builder()
.setTransport(httpTransport)
.setJsonFactory(jsonFactory)
.setServiceAccountId(SERVICE_ACCOUNT_EMAIL)
.setServiceAccountScopes(Arrays.asList(DriveScopes.DRIVE))
.setServiceAccountUser(userEmail)
.setServiceAccountPrivateKeyFromP12File(
new java.io.File(SERVICE_ACCOUNT_PKCS12_FILE_PATH))
.build();
Drive service = new Drive.Builder(httpTransport, jsonFactory, null)
.setHttpRequestInitializer(credential).build();
Files.List request = service.files().list();
When i am executing this request as follows :
FileList files = request.execute();
I got only 'userEmail
' (Provided while creating service) files.
How i can get all domain google drive files ?? i have used super admin but i couldn't get.
Upvotes: 3
Views: 1089
Reputation: 13528
To get all files in your Google Apps domain you would need to:
The combined results of all these calls would be all files in your Google Apps domain.
Upvotes: 8
Reputation: 1027
You can't :) because Google Drive file ownership logic is user-centric.
You can only list files that are in the "My Drive" of the user used to call APIs.
Upvotes: 1