Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the owner of file using Google Drive API

I am thinking of developing an application like this:

  1. My application has a google-service-account
  2. I let my users share their documents with my service account
  3. While an user visits my application, he gets some reports based on the files he has shared.

For this, my application needs to uniquely identify the owner of the documents shared with it. I looked at the API but could not find how to do so. I found methods like File.getOwnerNames(), but they are plain strings containing the names, but not any unique key to identify the user.

Need help on how to achieve this. Thanks.

Sanjay

like image 276
Sanjay Avatar asked Jul 03 '12 05:07

Sanjay


1 Answers

Use the permissions.list method and find the permission corresponding to the owner.

like image 172
Ali Afshar Avatar answered Jan 01 '23 11:01

Ali Afshar