如何通过API知道谁在Google云端硬盘的共享驱动器(团队驱动器)中创建了文件

如何通过API知道谁在Google云端硬盘的共享驱动器(团队驱动器)中创建了文件

问题描述:

所有有权访问共享驱动器(团队驱动器)的用户均可访问google驱动器中共享驱动器(团队驱动器)中的所有文件.

All the files in Shared drive (Team Drive) in google drive are accessible by all users who have access to Shared Drive (Team Drive).

默认情况下,在共享驱动器(团队驱动器)中创建新文件时,所有有权访问共享驱动器(团队驱动器)的用户也将成为所有者.

When a new file is created in a Shared Drive(Team Drive) by default all the users with access to Shared Drive(Team Drive) will become owners as well.

问题:当我们在共享驱动器(团队驱动器)的文件夹中使用API​​列出文件时,如何检测是谁创建了文件?

Question : when we list the files using APIs inside a folder in Shared Drive (Team Drive), how to detect who created the file ?

您可以使用修订版API

因此,如果您在参数 fields 中列出指定 revisions/lastModifyingUser,revisions/id 的文件的修订,则可以检索文件的更改以及相应的更改修改文件的用户.

You can use the Revisions API

So, if you list the revisions of a file specifying revisions/lastModifyingUser, revisions/id in parameter fields, you can retrieve the changes of the file and the corresponding user who modified the file.

因此,第一个修订版("id":"1" )应对应于文件的创建/上传,而相关的 lastModifyingUser 是创建者文件.

Thereby, the first revision ("id": "1") should correspond to the creation / upload of the file and the related lastModifyingUser is the creator of the file.

其他信息:

  • 列出文件,将返回具有指定属性的文件资源此处-资源具有所有者"之类的属性,或"lastModifyingUser",但不幸的是不是"creator"
  • 已经有一个功能请求,要求实施该选项以检索添加了该用户的用户文件到共享驱动器.-您可以加星标"它可以提高知名度,从而有望早日实施
  • 直到不幸的是,如果没有Revisions API的解决方法,您将无法检索文件创建者
  • Listing files, will return a files resource with the properties as specified here - The resource has properties like "owners" or "lastModifyingUser", but unfortunately not "creator"
  • There is already a feature request asking to implement the option to retrieve the user who added a file to a shared drive. - You can "star" it to increase visibility and thus hopefully sooner implementation
  • Until then unfortunately you cannot retrieve the file creator without the workaround with the Revisions API