Getting subfolders of the selected folder using a script

Assume there is a folder, and you need to get the list of its subfolders. You can find the Id of a folder on the page of this folder: it is the list number in the browser URL bar. To search subfolders, create a filter with a search criterion (in this case, the Id of the parent folder) and apply it to objects of the Folder type.

Script without using PublicAPI

For the script to use correctly, add namespaces:

using EleWise.ELMA.Documents.Managers;
using EleWise.ELMA.Documents.Models;
using EleWise.ELMA.Model.Managers;
using EleWise.ELMA.Services;
 
Script example:
//creating a filter
var filter = new InstanceOf<IDmsObjectFilter> {
New = {
         //filter criterion - the parent folder; load it by id
         Folder = (Folder)FolderManager.Instance.LoadOrNull(10),                    
      }
}.New;
//apply the filter to the Folder objects, thus getting the list of the parent folder subfolders
var folderz = EntityManager<Folder>.Instance.Find(filter, null).ToList();
 
As the result of the script execution, the local variable folderz will contains the required list of subfolders. You can rewrite it to a context variable or process in the script using the specified local variable.
 
Creating a similar script with PublicAPI
Documentation on PublicAPI is available here

Add namespaces:

using EleWise.ELMA.API;
using EleWise.ELMA.Documents.Models;
 

Script text:

var childrens = PublicAPI.Docflow.Folder.GetAllChildren(PublicAPI.Docflow.Folder.LoadOrNull(36)).OfType<IFolder>().ToList();