Transfer ownership of a folder to an external user
Hello folks,
I have a tool to facilitate transferring folders to new owners as people leave. It does the following steps:
1. Add new owner-to-be as co-owner
2. Promote new co-owner to owner
3. Re-fetch the collaboration list to locate the previous owner
4. Remove the previous owner from the collaboration
This works fine when the new owner is in our domain. However, sometimes it's appropriate to transfer a folder to an external user. In those cases, I lose visibility into the folder after step 2, even using as-user who should still be a collaborator on the folder. The result is a dangling collaborator in the folder that we'd like to clean up. (Often this is a service account that we move content to as we delete user accounts. We really don't want this service account to continue as a collaborator.)
A user can do this via the GUI. Is there any way to accomplish the same thing via the API?
Thanks for any help
-Chuck
-
With some help from Box Support, I have a viable workflow for this now.
The content of external collaborators cannot be seen with impersonation via the As-User header. It's necessary to get a token for the former owner (now the collaborator) in order to be able to retrieve the list of collaborators and find the collaboration ID that must be deleted. Once you have the collaboration ID, the As-User impersonation is sufficient to delete the object, so it's just a single call that needs the user token.
Because I had to search hard to find it, I'll also mention that you obtain a user token by constructing a JWT with box_sub_type = 'user' and sub = the internal ID of the target user.
Hope this helps someone.
-Chuck
サインインしてコメントを残してください。
コメント
1件のコメント