cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get the subfolders of a subfolder in nuxeo just by iterating in one go using nuxeo client

Jyothsna_SM1
Champ in-the-making
Champ in-the-making
10 REPLIES 10

Gregory_Carlin
Elite Collaborator
Elite Collaborator

Hello,

Patrick_Abgrall
Star Contributor
Star Contributor

A guess of answer from https://doc.nuxeo.com/nxdoc/nxql/ :

ecm:ancestorId: the id of an ancestor of the document (parent, grand-parent, etc., up to the root). This is only useable in a WHERE clause with the syntax ecm:ancestorId = 'some-doc-id' or ecm:ancestorId <> 'some-doc-id'. It's an alternative to ecm:path STARTSWITH '/some/doc/path' if you know the id instead of the path. See also ecm:path. (Since Nuxeo 5.9.6)

So If you're looking for a NXQL query to be used in a Nuxeo client, SELECT * FROM Folder WHERE ecm:ancestorId = <top folder id> or SELECT * FROM Document WHERE ecm:ancestorId = <top folder id> AND ecm:primaryType IN ('Folder', 'your custom type'...) might look like an answer to your question.

Would you want only first level subfolders, the NXQL query would look like: SELECT * FROM Folder WHERE ecm:parentId= <top folder id> or SELECT * FROM Document WHERE ecm:parentId = <top folder id> AND ecm:primaryType IN ('Folder', 'your custom type'...)

Hi,

Hi Patrick,

There is nothing out of the box except all levels or first level. You can however automate your custom need using some JavaScript automation,

Jyothsna_SM1
Champ in-the-making
Champ in-the-making

Hi Patrick,

Getting all the sub-folders of a folder worked. Is there any way I can get sub-folders only till required level. I mean if I need only till second level or third level. Can we control how many levels to get?

Thanks in advance!!

Patrick_Abgrall
Star Contributor
Star Contributor

There is nothing out of the box except all levels or first level. You can however automate your custom need using some JavaScript automation,

I'm working on the backend only with java client I have no idea about java script. Is there a way we can do it on backend

Bhagat__Singh
Champ in-the-making
Champ in-the-making

hi Gregory [Gregory Carlin](https

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.