在 Google.Apis.Drive.v2.Data.File
类中,它仅提供最后修改用户的名称。如何获取用户的完整信息(如电子邮件、用户 ID 等)?
var service = new DriveService(auth);
Google.Apis.Drive.v2.Data.File file = service.Files.Get("fileid").Fetch();
file.LastModifyingUserName;// = "User Name" //How to get email id of this user?
在一个组织中,可以有不止一个人的名字和姓氏相同。区分的是用户ID。所以我需要电子邮件 ID。
E.g Allan Donald => allan1@corp.com
Allan Donald => allan2@corp.com
这很有可能。
最佳答案
我想出了如何在 Java API 中做到这一点。它远谈不上优雅,但它确实有效。
File file; // start with your file
User user = file.getLastModifyingUser();
Permission permission = service.permissions().get(file.getId(), user.getPermissionId()).execute();
String email = permission.getEmailAddress();
您也可以使用 RevisionList 接口(interface)获取所有修改用户。
关于c# - 如何使用 google drive API 获取最后修改的用户信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16609823/