Oleg Burlaca
Oleg Burlaca

Reputation: 81

How to get google UserID by email or GoogleDrive permissionId

Google Drive returns:

https://developers.google.com/drive/api/v3/reference/permissions

Google Drive Activity API v2 returns Google UserID, example: personName: people/ACCOUNT_ID https://developers.google.com/drive/activity/v2/reference/rest/v2/activity/user#KnownUser

How can I match user email OR userPermissionId against 'people/ACCOUNT_ID' ?

Is there a way I can get ACCOUNT_ID having user email/permissionId or vice versa?

Upvotes: 5

Views: 1484

Answers (2)

ziganotschka
ziganotschka

Reputation: 26806

Provided you have the personName from the Drive Activity API:

  • This name corresponds to the People API resourceName

  • Make a people.get request specifying the resourceName of form people/xxxxx and set personFields to emailAddresses and fields to emailAddresses/value

  • The Drive API v3 method Permissions: list will return you all existing permission ids and matching emailAddresses for a specified file

  • There is no way to filter Permissions: list results directly by emailAddresses, so you would need to implement a programmatic functionality to compare all permissions for a file against a certain user name

Upvotes: 1

PlugHead
PlugHead

Reputation: 11

people.get request will give you nothing if resourceName not equal to people/me or person not in your contact list.

Upvotes: 1

Related Questions