Hi @vweinstein ,
Welcome to the forum!
I did some investigation, and found out that via the API:
- There is no way to list external users. We can at best find an external user based on it’s complete login email, for example:
❯ box users --csv --fields type,id,name,login -e --filter barduinor+EXT02@gmail.com
type,id,name,login
user,28591479722,EXT02 xx,barduinor+EXT02@gmail.com
- There is no way to delete external users
External users are created via collaborations
and using the API can only be remove if all their collaborations
are removed.
- There is no way to list all the collaborations, we can only request the collaborations for specific files, folders, groups (to which external users can’t belong) and list pending collaborations.
This means you would have to list every file and folder, and for each one get the collaborations.
- Listing the collaborations for a file or folder, although identifies the user it doesn’t say if the user is external or managed.
This means you would have to somehow create a list with the id’s of the external users.
From all the above, deleting the external users manually may seem to be the best bet, however there is another option (thank you @hass )
You could ask your administrator to create a collaborations report:
Filter the report only by external users:
Which looks like:
Collaboration ID,Owner Name,Owner Login,Path,Path IDs,Item Name,Item ID,Item Type,Collaborator Name,Collaborator Login,Collaborator Type,Collaborator Permission,Inviter Email,Invited Date,Invite Accepted Date
45626725056,Rui Barbosa,barduinor@gmail.com,All Files/folder_to_upload/4PL8AF/,0/213535013408/213534631621/,4PL8AF,213534631621,Folder,barbasr@gmail.com,barbasr@gmail.com,External,Editor,barduinor@gmail.com,22-Jun-23,22-Jun-23
48170737751,Rui Barbosa,barduinor@gmail.com,All Files/A_Class/,0/220421706333/,A_Class,220421706333,Folder,EXT02 xx,barduinor+EXT02@gmail.com,External,Editor,barduinor@gmail.com,7-Sep-23,7-Sep-23
The report generation might take a while…
But this .csv
does output only external collaborations, the specific object type (file or folder), the object id, and the collaboration id.
You can just remove all the collaborations, or use the extra data to figure out which ones you want to keep, for example an email , file or folder white list.
From here you should be able to create the final .csv
to send to the Box CLI:
❯ box collaborations:delete --help
Remove a collaboration
USAGE
$ box collaborations:delete ID
ARGUMENTS
ID The ID of the collaboration to delete
OPTIONS
-h, --help Show CLI help
-q, --quiet Suppress any non-error output to stderr
-s, --save Save report to default reports folder on disk
-t, --token=token Provide a token to perform this call
-v, --verbose Show verbose output, which can be helpful for debugging
-y, --yes Automatically respond yes to all confirmation prompts
--as-user=as-user Provide an ID for a user
--bulk-file-path=bulk-file-path File path to bulk .csv or .json objects
--csv Output formatted CSV
--fields=fields Comma separated list of fields to show
--json Output formatted JSON
--no-color Turn off colors for logging
--save-to-file-path=save-to-file-path Override default file path to save report
ALIASES
$ box files:collaborations:delete
$ box folders:collaborations:delete
EXAMPLE
box collaborations:delete 12345
Hope this helps!
Cheers
Hi Rui,
Thank you for this extensive answer.
We were able to put together a csv with the header of ‘ID’ at the top row, and then cleared it all out.
Thanks for your guidance.
-Vlad Weinstein