Mark
Mark

Reputation: 1537

Is it possible to get the owner for a Google Drive file?

When I look at my Google Drive online, I see files have the owner listed, sometimes shown as "Shared By" myself or someone else. Is it possible to obtain this value programmatic-ally (using C#)?

Ideally I want to have someone share a file with me, then me do some processing on the file (via a Windows Service), and then me re-upload the file with it's alterations. I would need to know the owner of the file though.

Is this possible? Is this possible without using the Google Drive API? - I'm thinking about using normal .NET/Windows functions to pull the file out of the Google Drive local folder...

Upvotes: 1

Views: 632

Answers (2)

Sanjay
Sanjay

Reputation: 8975

I have a similar need. I am thinking of developing an application to process the files shared by users and display them some reports. So, my application needs to uniquely identify the owner so that only he and none other can view the reports for his files.

Looking at the answer given above by Claudio, I debugged in Java to examine the "userPermission" field, but could not find anything of help. I also examined other fields of the file, but got nothing except the name of the owner in string format.

Is there a way it can be achieved? Would need some help. Thank you.

Upvotes: 0

Claudio Cherubino
Claudio Cherubino

Reputation: 15024

File resources returned by the Google Drive API include a userPermission field which lists users authorized to access the document together with their role (owner, reader or writer):

https://developers.google.com/drive/v1/reference/files#resource

Upvotes: 1

Related Questions