问题
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.
Question : when we list the files using APIs inside a folder in Shared Drive (Team Drive), how to detect who created the file ?
回答1:
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.
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.
Additional information:
- 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
来源:https://stackoverflow.com/questions/62666869/how-to-know-through-apis-who-created-the-file-in-shared-drive-team-drive-in-go