0

What is the most efficient way of getting all Box Ids for every file in all subdirectories of a parent folder in Box API using the .net core SDK?

Irish Redneck
  • 983
  • 7
  • 32

1 Answers1

0

Unfortunately Box API does not expose an end point that lists all files and folder for. user or an enterprise.

The most used workaround for this is to recursively list the items starting from the root folder, which id is always 0.

This comes with its own set of challenges. For example for large Box users with millions of files and folders, you may hit the rate limits of the API (1000 requests/minute).

Also depending of how the content sharing is structured you may need to user a service account impersonating the users and cycle through these, or use the enterprise scope, which must be activated by request.

  • Thats a bummer. Do you have any examples or solutions of how you would recurse through the folder structure to pull these IDs in the .net core SDK? We want to shift to box but we have about 30k files we need to move over and we only have Path and file names as that is what our previous storage provider allowed. Thanks! – Irish Redneck May 10 '23 at 16:22
  • I'm not much of a C# coder or I would build you one, still looking for an example though. I'm assuming a Python example wouldn't work for you... You did mention "shift to box", and my understanding is you want to move files from some other provider into box. If that is correct we have a feature called Box Shuttle that will do that for you. I'm not sure it fits your use case, but take a look at it if you haven't yet. – rb-devrel-box May 11 '23 at 16:08
  • We already have moved the files but now we have 30k files we need to get the ID for into our DB. I was hoping for a quicker way to do this. Recursively going through the folder structure does not seem to be a great option considering the amount of requests as you indicated. – Irish Redneck May 11 '23 at 17:39
  • It depends if it is a one time thing and after that you just get the deltas (new files). There may be other ways of solving your use case. Let me know if you want to discuss. – rb-devrel-box May 12 '23 at 15:40