2013-05-17 45 views
2

Google.Apis.Drive.v2.Data.File類中,它只提供最後修改的用戶的名稱。如何獲得用戶的完整信息(如電子郵件,用戶ID等)。如何使用Google Drive API獲取上次修改的用戶信息?

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。

E.g Allan Donald => [email protected] 
    Allan Donald => [email protected] 

這是非常可能的。

+0

https://developers.google.com/drive/credentials – 2013-05-17 13:08:03

+0

https://developers.google.com/drive/examples/dotnet for c sharp – 2013-05-17 13:09:47

+0

我認爲你沒有正確地解決問題。爲了更清晰起見,我編輯了我的帖子。 –

回答

0

我想出瞭如何在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接口獲取所有修改用戶。

+0

是的。此方法在3.5版SDK中不可用。 –

相關問題