修订列表并获取缺少的信息

时间:2017-07-06 20:33:43

标签: google-drive-api google-apis-explorer

使用Google API资源管理器以及Google Drive API v3 的官方C#库,大多数documented fields都缺少回复。我特别需要访问谁进行了修订,可以通过$.lastModifyingUser访问。

我已经在我的域管理员帐户和服务帐户上尝试了此操作,因此不应该成为权限问题,至少不是我能看到的。如果有的话,我做错了什么?

List

{
 "kind": "drive#revisionList",
 "revisions": [
  {
   "kind": "drive#revision",
   "id": "1",
   "mimeType": "application/vnd.google-apps.spreadsheet",
   "modifiedTime": "2016-11-16T18:29:29.527Z"
  },
  {
   "kind": "drive#revision",
   "id": "14",
   "mimeType": "application/vnd.google-apps.spreadsheet",
   "modifiedTime": "2016-11-16T18:35:49.184Z"
  },
  ...

Single get

{
 "kind": "drive#revision",
 "id": "134088",
 "mimeType": "application/vnd.google-apps.spreadsheet",
 "modifiedTime": "2017-05-24T11:48:00.788Z"
}

2 个答案:

答案 0 :(得分:1)

您需要在请求中添加fields="*"fields="permissions(id,lastModifyingUser)",以指示云端硬盘返回完整资源。默认情况下,仅返回最小的属性集。

答案 1 :(得分:0)

我无法从修订版API检索“ lastModifyingUser”,但可以从Files.get示例中检索“ lastModifyingUser”:

    File foundFile = service.files().get(id)
            .setSupportsTeamDrives(true)
            .setFields("parents, webViewLink, properties, lastModifyingUser")
            .execute();

    System.out.println("Found file is " + foundFile);
    System.out.println("Parents " + foundFile.getParents());
    System.out.println("Owners " + foundFile.getOwners());
    System.out.println("Props " + foundFile.getProperties());
    System.out.println("Last user " + foundFile.getLastModifyingUser());