Check if the user is already a collaborator before adding them
AnsweredI simply want to check prior to adding a collaborator. I would like to do something along the lines of:
if (the user exists as collaborator) do nothing
else (add the collaborator)
I can't find a clear answer to how to do this in Python and the Box API.
Any suggestions?
(I get a weekly dump of users with email addresses. It's not incremental, it's all the active users in a portal. At some point users could have been already been invited to a folder. I am cycling through the dump each week or so and mostly there's an error if the users exists but I'd like to make it cleaner and skip them if they exist. Similar to the Pre Flight Check.
-
Official comment
Hello,
There isn't a perfect way to do this today. You would need to find all the collaborations for a folder and parse through those collaborations to check if a user is already collaborated.
You could also just try adding everyone as a collaborator - you'll get 400 errors saying they are already collaborated.
Thanks,
Alex, Box Developer Advocate
Comment actions
Please sign in to leave a comment.
Comments
1 comment