How to buy
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © 2025 Autodesk Inc. All rights reserved
The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.
Hi,
I'm trying to create a breadcrumb bar for my project and was wondering if there's an easier way to get all the parents(hubs/projects/folders) from a project/folder/file ? Currently we're doing it by calling this function:
function getFolderParentRecursive(projectid, folder, arrayin, topfolders, credentials) { if (!credentials) { console.error("getFolderParentRecursive:Credentials null"); return null; } return new Promise(function (fulfill, reject) { // do a thing, possibly async, then… if (folder.id != undefined && projectid != undefined) { arrayin.splice(0, 0, folder); //Check if current folder is top folder.... for (var i = 0; i < topfolders.length; i++) { if (folder.id == topfolders[i].id) { //Det är en topfolder fulfill(arrayin); } else { FoldersApi.getFolderParent(projectid, folder.id, oAuth2ThreeLegged, credentials).then(function (folderparent) { //arrayin.splice(0, 0, folderparent.body.data.id); if(folderparent != null) { getFolderParentRecursive(projectid, folderparent.body.data, arrayin, topfolders, credentials).then(function (parentarray) { arrayin = parentarray; fulfill(arrayin); } , function (err) { console.error(err); reject(err); //getFolderParentRecursive }); } } , function (err) { console.error(err); reject(err); //Folder Parent }); } } } }); }
But this way is very sluggish or slow even. Would have been nice to see the API returning all parents right from the json response for current location.
(Have a screenshot on what ours looks like right now... )
Thank you in advance for a quick reply.
/Claes
Hi clwi,
What API are you using? BIM 360 Field classic >> /api/library/ ?
We're writing an node.js app and using the forge api
Hi clwi,
Thank you for the clarification. I should have been familiarize myself with SDK, too. But I tend to stick with RESTSharp as I usually need to test new APIs before it is incorporated in the SDK.
Anyway, I thought that by the time you reach to a certain file or folder, you have gone through hubs >> projects >> top folders >> sub holders^n
and you keep track of those.
But I guess, if you click on a certain node in a tree in UI, for example, that node does not keep cascading ancestor list by default. You will need to find out.
To my best of knowledge, going backward following parents, which you are using, seem to be the way.
That said, one thing that made me think worth logging a wish is that,
when I was looking at the response example on the documentation carefully, the example includes name "path", but it is not when actually look at through my test.
it isn't in schema, either.
If you want to ask this as an enhancement request, you may try stackoverflow:
https://fieldofviewblog.wordpress.com/2016/10/27/where-to-get-help-about-forge/
How to buy
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © 2025 Autodesk Inc. All rights reserved
Type a product name