Skip to main content

Hi Team,



Is there a way to query a specific user collaboration ID to a specific folder using Box CLI?



Best Regards

Hi @user711,



There is. What are you trying to do? I have some PowerShell that uses the CLI to:





  1. Get all the files and folders a user has shared with them


  2. Pulls out the collaborations on that file


  3. Returns the users who are part of that collaboration




Is that what you are looking for?



Regards



John


Hi Johan,



Thanks for you follow up, I have the files and folders ids and I want to get collaboration id for specific users who collaborate these files and folders, currently when I run the CLI command for a specific file or folder, it gives the full list of all collaboration ids instead i need the collaboration ids for specific users.



Best Regards


I don’t think you can do that. When you get the collaborations back it is a collection so you need to go through and find the individual collaboration that is for your user. This is what I am doing in PowerShell:



foreach ($collaboration in $collaborations)

{

if ($collaboration.accessible_by.id -eq $AsUser)

{

"============================================================================="

$item.id + " - " + $item.name + " - " + $item.type + " - " + $collaboration.role + " - " + $collaboration.accessible_by



}

}


Reply