Reputation: 96
I have a Google Apps form link, and need to find the owner of the form.
I setup a service account with 2 leg auth. Tested the code (python, using google-api-python-client and oauth2client) that can impersonate a user and pull a list of files from that account, so the code is working in that senario. However, in this particular case, I only know a file id, I'd like to know the owner. Here is the relavant code section:
credentials = SignedJwtAssertionCredentials(
'[email protected]',
key,
scope='https://www.googleapis.com/auth/drive'
)
http = httplib2.Http()
http = credentials.authorize(http)
service = build("drive", "v2", http=http)
# Search file by id
file_id = 'xxxxxxxxBMWnkxVEhnUnF5eEh1Snc6MQ'
f = service.files().get(fileId=file_id).execute()
I got "File not found" error. I know the file is there because the link to the form is alive. I tested with a test account. If I gave both file_id and the test account as prn param to SignedJwtAssertionCredentials, I can find the file and its metadata.
apiclient.errors.HttpError: <HttpError 404 when requesting https://www.googleapis.com/drive/v2/files/xxxxxxxxBMWnkxVEhnUnF5eEh1Snc6MQ?alt=json returned "File not found: dEtpdmlCYzBMWnkxVEhnUnF5eEh1Snc6MQ">
Is it possible to find a file's metdata (owner included) if I the only information I know is a form's id? BTW, Google Apps console audit log doesn't seems to inclue forms.
Thanks!
xsf
Upvotes: 0
Views: 520
Reputation: 882
I'll let the folks from Google confirm, though based on my own experiences with the APIs, the file is invisible and effectively non existent if you don't have permissions to access it.
This is likely for security reasons.
Upvotes: 1