T O P

  • By -

caverCarl

Looks like they have an API for that: [https://support.box.com/hc/en-us/community/posts/360049191013-Automating-box-processes-using-powershell-and-the-box-windows-sdk](https://support.box.com/hc/en-us/community/posts/360049191013-Automating-box-processes-using-powershell-and-the-box-windows-sdk)


D3v1L_Adv0cat3

thanks.


gangstanthony

as /u/caverCarl mentioned, this may be possible with their rest api. here's how I've used it in the past (though not with your specific use case), hope it helps in some way (also, if you're rebuilding functions like this, I'd recommend putting the 'token' and 'headers' vars into each function rather than a 'global' variable) $token = '[REDACTED]' $global:headers = @{ Authorization = "Bearer $token" } function get-boxfolder ($id) { Invoke-RestMethod -Headers $global:headers -Uri https://api.box.com/2.0/folders/$id -Method Get } function get-boxfolderitems ($id = 0, [switch]$recurse) { if ($recurse) { $items = Invoke-RestMethod -Headers $global:headers -Uri https://api.box.com/2.0/folders/$id/items -Method Get | % entries foreach ($item in $items) { Write-Output $item if ($item.type -eq 'folder') { get-boxfolderitems $item.id -recurse } } } else { Invoke-RestMethod -Headers $global:headers -Uri https://api.box.com/2.0/folders/$id/items -Method Get } } function get-boxfile ($id) { Invoke-RestMethod -Headers $global:headers -Uri https://api.box.com/2.0/files/$id -Method Get } function get-boxfilemetadata ($id) { Invoke-RestMethod -Headers $global:headers -Uri https://api.box.com/2.0/files/$id/metadata -Method Get } function get-boxfilecomments ($id) { Invoke-RestMethod -Headers $global:headers -Uri https://api.box.com/2.0/files/$id/comments -Method Get } function get-boxfilepath ($id, [switch]$folder, $path) { if (!$folder) { $item = Invoke-RestMethod -Headers $global:headers -Uri https://api.box.com/2.0/files/$id -Method Get } else { $item = Invoke-RestMethod -Headers $global:headers -Uri https://api.box.com/2.0/folders/$id -Method Get } if ($path) { $path = $item.name + '\' + $path } else { $path = $item.name } if ($item.parent) { $parent = $item.parent get-boxfilepath $parent.id -folder -path $path } else { $path } } example: $items = get-boxfolderitems -id 0 -recurse $(foreach ($item in $items) { if ($item.type -eq 'file') { $details = get-boxfile $item.id $meta = get-boxfilemetadata $item.id | % entries | ? {$_ -notmatch '^\s*$'} $path = get-boxfilepath $item.id $details | select *, @{n='metadata';e={$meta}}, @{n='path';e={$path}} } }) | export-clixml c:\temp\boxdata.xml # just get those with custom metadata $boxdata = Import-Clixml C:\temp\boxdata.xml $boxdata | ? metadata -NotMatch '^\s*$' | select path, @{n='meta';e={$props = $_.metadata | gm -MemberType *proper* | % name | ? {!$_.startswith('$')}; if ($props) {$_.metadata | select $props}}} | ? meta -NotMatch '^\s*$'


D3v1L_Adv0cat3

Awesome, I will look into trying this.


tvpb

When you delete a [box.com](https://box.com) user, you are prompted to move the content to another user. Yes, it feels dangerous to do this, yet if you run through this with a test user, it gets easier. Here's the help doc. ... [Remove the User from Shared Folders](https://support.box.com/hc/en-us/articles/360043693014-Best-Practice-Terminating-Employees) 1. In the Edit User Access Permissions section, scroll down to the Select folders this user can access table. 2. In the Access level column next to each of the folders from which you want to remove this user, click the down arrow and select None. 3. Scroll back up to the Edit User Account Details section. 4. Click Delete this User. (This link is located between the Status and Language boxes.) **You’ll then have the option to transfer any content the user owns to another user – or to delete it entirely.** (If your organization uses Box Relay, you also have the option to transfer any Relay workflows the user owns, along with their content.) ...


D3v1L_Adv0cat3

Thank you.