Files and folders extraction sample
This sample demonstrates how to retrieve data of all the folders and files on a specific project to show on a table and export it as CSV.
On the typical workflow of a project, we might need to generate a list containing its files and folders, as it's helpful to track our project data over time and also generating dashboards (thanks Tadeh for explaining the scenario and reviewing the idea).
That's what this sample is about!
Here we'll cover a method for retrieving the data (folders and files) of your projects and generate a table with that.
Expanding this sample, you can filter, style, expand, and export these data as you need.
Retrieving the content
Retrieving folders and files from specific projects is not a big deal, and we do this on our basic sample from our tutorial.
The main difference here is that we don't expand our object tree further than the project level, and we can't count on any user input rather than the project and hub id.
From the selection of the project, we get the top folders, then the folders and files recursively.
When we retrieve this much content, we might step into a few issues such as rate limiting and connection timeout.
We have an amazing blog on that (refer here), and as this sample is based on .NET we're using hangfire for queueing.
Below you can see how we're improving our sample through a diagram:
- The user selects one project
- The client reaches the server to read related contents from BIM360/ACC
- Server enqueue a job to read the data and store it on a database, and returns success to the client
- When the job is done, the server retrieves and delete the data stored on the database, and pass it to the client
- The client shows the data on the table and repeats step 2 for all the folders it just received
Showing and exporting
With this workflow, we can show the data as it comes back from our server, and also have a status based on the number of extractions started/ended.
In the end, we can filter and export the data as a CSV to generate some dashboards, for instance.
Here’s a live demo:
You can follow me on Twitter: twitter.com/JooPaulodeOrne2