如何使用谷歌API的驱动器来获得最后修改的用户信息? [英] How to get last modified user information using google drive API?

查看:157
本文介绍了如何使用谷歌API的驱动器来获得最后修改的用户信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google.Apis.Drive.v2.Data.File 类,它只是提供了最后一次修改用户的名称。如何获得用户的充分信息(如电子邮件,用户ID等)。

In Google.Apis.Drive.v2.Data.File class it just provides name of the last modified user. How to obtain full info of the user (like email, user id etc.).

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

In an organization there can be more than one person with the same first and last name. It is user id which differentiates. So I need email ID.

E.g Allan Donald => allan1@corp.com
    Allan Donald => allan2@corp.com

这是非常可能的。

推荐答案

我想出如何做到这一点在Java的API中。它是远离优雅,但它的工作原理

I figured out how to do it in the Java API. It's far from elegant, but it works.

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接口来获取所有修改用户。

You can also use the RevisionList interface to get all the modifying users.

这篇关于如何使用谷歌API的驱动器来获得最后修改的用户信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆