【问题标题】:How to get last modifying user information using google drive API?如何使用谷歌驱动 API 获取最后修改用户信息?
【发布时间】:2013-05-17 13:04:50
【问题描述】:

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

这很有可能。

【问题讨论】:

  • 我认为您没有正确解决问题。为了更清晰,我编辑了我的帖子。
  • LastModifyingUserName 仅包含名称,而不包含电子邮件 ID 或用户 ID。但我需要最后修改用户的用户 ID 或电子邮件 ID。
  • 使用我们现有的权限模型和 API 功能无法检索用户电子邮件。不过,我们正在努力改进它。

标签: c# google-drive-api


【解决方案1】:

我想出了如何在 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接口获取所有修改用户。

【讨论】:

  • 是的。 SDK 3.5版本不支持此方法。
猜你喜欢
  • 1970-01-01
  • 2021-12-23
  • 1970-01-01
  • 1970-01-01
  • 2013-08-11
  • 1970-01-01
  • 2020-01-15
  • 2018-05-25
  • 1970-01-01
相关资源
最近更新 更多