Friday, 15 August 2014

java - Google Drive API - How to work with the domain-wide service account and get all document list from domain -



java - Google Drive API - How to work with the domain-wide service account and get all document list from domain -

i trying utilize service business relationship of app access documents of users in domain. next these instructions: https://developers.google.com/drive/delegation

but didn't work. please help me out on this??

here problematic line of code

googlecredential credential = new googlecredential.builder() .settransport(transport) .setjsonfactory(jsonfactory) .setserviceaccountid("service_account_email") .setserviceaccountprivatekeyfromp12file( new java.io.file("service_account_pkcs12_file_path")) .setserviceaccountscopes(scopes) .setserviceaccountuser("abc@xyz.com").build();

it's working fine, should give me details user domain... instead gives me 1 useraccount.. in "service" business relationship doc says should able access user's info under domain.

scopes added , apis enabled business relationship

i don't think docs meant can have service business relationship , in 1 go access files in whole domain, need deed on behalf of particular user using service business relationship .setserviceaccountuser("abc@xyz.com").

the service business relationship saves hassle of having request permission individual users. way think can accomplish want retrieve users in domain using directory api in admin sdk (see reply listing users using google admin sdk in java) loop through these users creating new credential object setting service business relationship user e.g. setserviceaccountuser("blah@blah.com").

then utilize drive sdk list files each user:

https://developers.google.com/drive/v2/reference/files/list

java google-app-engine google-drive-sdk

No comments:

Post a Comment