I have read from previous posts [1, 2, 3] that the email address is not displayed for Google Drive Permissions API due to privacy reasons. But I am trying to look for a way to display user permissions where there are 2 different users with the same name.
With the Google Drive sharing UI, you can differentiate two different users with the same name as it also displays their email next to their name (I don't see why this is not possible in the API if the Google Drive UI can get it).
I would prefer not having to rely on the now deprecated DocList API to get the emails from the ACLs.
Unfortunately, using the documents list API is your only option for now to get the email addresses, sorry.
With v3 API yu can specify the fields parameter of your request.
For Get request : request.Fields = "kind,id,type,emailAddress,domain,role,allowFileDiscovery,displayName,photoLink,expirationTime,teamDrivePermissionDetails,deleted"
For List request : request.Fields = "permissions(kind,id,type,emailAddress,domain,role,allowFileDiscovery,displayName,photoLink,expirationTime,teamDrivePermissionDetails,deleted)"
About about = service.about().get().execute();
User user = about.getUser();
System.out.println("user" + user.toString());
You can print out the user information (JSON string). It contains the emailAddress.
You can parse the JSON string for the emailAddress.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With