Skip to main content
Question

API Powershell copy all user's folders to new location

  • May 22, 2025
  • 2 replies
  • 8 views

Forum|alt.badge.img

I have a ton of code that probably work in some other systems but I am on Windows. I have a Powershell console and the Windows CLI and my disposal. cURL commands are just a wall of red text when run as offered by the Box documentation. I need a means by which I can copy a terminated user's Box files to a new location. So it would be something like username john_doe left the company. I need to create a folder for this user in our termed_users folder and copy all of john_doe's files to this new termed_users/john_doe folder. 

2 replies

Forum|alt.badge.img

I get the error:
Invoke-WebRequest : Cannot bind parameter 'Headers'.
so I reformatted it to include the ^ 
curl https://api.box.com/2.0/folders/folder_id/copy ^ -H "Authorization: Bearer

and

curl https://api.box.com/2.0/folders/folder_id/copy ^ -H @{"Authorization: Bearer 

 

Each was using the actual folder ID and not "folder_id" in the URL. It all returns the same error


Forum|alt.badge.img

Hey , 

 

Have you tried using the Box CLI: https://developer.box.com/docs/box-cli? 

 

If not, it makes calls like this really easy! You'll need to install and set it up, but after that, it's a breeze. 

 

Where does the termed_users folder live in Box? Is it already existent? If so, does it live under your Box account or under an account of its own? 

 

Best, 

Kourtney