I would like to control the activity of a shared folder that I have in Google Drive.
I am using the Google Drive Activity API to see the real-time information of the files but I came across two problems:
I can only see the modifications in the folder made by me and not by the others. (I suppose there's something about the 2AuthClient token)
I can't get to know if a file was renamed or not (which is not that important at the moment)
I was thinking that maybe a solution would be to ask that each account that has access to the folder to create an Auth2Client token and send it to me. After that run a function for each person who sends their token, the problem I see with that is the simple act of sharing a token which is personal and private but also the fact of doing multiple functions with the same code inside is not very logical.
Has anyone faced the same problem and found a solution?
My code is from the Developpers Google platform: here
And even if in the code it's supposed to get the ActorInfo, it only gives me as the actor because it only sees my modifications and not the other modifications.
Or even if someone knows another way to achieve this task (maybe without google drive activity API) it will be very helpfull. Thanks in advance!
CodePudding user response:
To show the activities to determined resources you have to add one of the following parameters as a union field key
: itemName
or ancestorName
. The default is ancestorName : items/root
if no key is specified
As stated in the documentation:
Fields | |
---|---|
itemName | string |
Return activities for this Drive item. The format is items/ITEM_ID . |
|
ancestorName | string |
Return activities for this Drive folder and all children and descendants. The format is items/ITEM_ID . |
In your case, as you want to query for a determined shared folder, you should add this inside the Request Body:
const param = {"ancestorName" : "items/<folder_id>"}