Get list of all folders (Java)

LabKey Support Forum
Get list of all folders (Java) ccharpen  2019-10-07 16:16
Status: Closed
 

As the title says, I want to get a hierarchical list of all folders.

This is what I've tried:

// Taking a stab in the dark here with the 'core' schema and 'Containers' query. 
SelectRowsCommand cmd = new SelectRowsCommand("core", "Containers");

// null for root. I was hoping this would return something useful, but as far as I can tell, it doesn't. 
SelectRowsResponse resp = cmd.execute(cn, null);

Thanks.

 
 
ccharpen responded:  2019-10-09 16:22
Status: Active

Bump. Got anything for me, labkey?

 
Jon (LabKey DevOps) responded:  2019-10-09 21:22
Status: Closed
Hi Corbin,

You need to leverage the GetContainers API to be able to get the hierarchical list of folders like you're looking for.

https://www.labkey.org/download/clientapi_docs/java-api/org/labkey/remoteapi/security/GetContainersCommand.html

Regards,

Jon
 
ccharpen responded:  2019-10-10 11:31
Status: Active
Thanks for the response, Jon.

If I set the command to include sub folders, the request times out. I noticed a "setTimeout()" API that I'm going to try. However, I think the request is slow because the sever is populating a lot of extraneous data that we don't need for each folder, chiefly "effectivePermissions". I also found an API for setting the command parameters, and I'm wondering if I can use this to filter out response fields on the server side. That said, I have no idea what to populate the setParameters() map with -- the documentation doesn't help here either.

Thanks.
 
Jon (LabKey DevOps) responded:  2019-10-25 23:46
Status: Closed
Hi Corbin,

Maybe the approach needs to be rethought? You said that you wanted to get a hierarchical list of all folders. Depending on how many containers you're working with, this can potentially be slow.

What specifics were you wanting to generate via the Java API when it comes to the container hierarchy?

Regards,

Jon