Get folders

  1. This example demonstrates how a folder can be retrieved by its id


    Here we are using the FindFolderById method of the LibrariesManager by specifying folder id. If there is no folder with the specified id the method returns null

  2. How to get the child folders of the specified parent folder:


    In this example we are creating first a folder by CreateFolder method of the LibrariesManager. Then we are creating two more folders that will be under the first folder. This is done by specifying the parent folder in CreateFolder method (another overload). We have to call the SaveChanges method in order to save the three folders. Finally we can get all child folders by the GetChildFolders method of LibrariesManager again by specifying the parent folder. 

  3. Getting the child items of a specified parent folder as IQueryable:


    This example demonstrates how to get all items under a specific folder. First we are creating an image album (could be video or document library also) via the CreateAlbum method of the LibrariesManager. For more information go to For developers: Create image libraries article. Next we are creating a folder with a child folder. For that purpose we are using two of the overloads of the CreateFolder method of the LibrariesManager. For more information go to For developers: Create folders inside libraries article. Then we are creating two images. One is under the parent folder created previously and the other under the child folder. Notice the new FolderId property introduced which specifies the id of the folder under which the image is going to be stored. Do not forget to call SaveChanges method of the LibrariesManager in order to save the folders and images. For more information on creating images go to For developers: Create images. Finally we are calling the GetChildItems method of the LibrariesManager by specifying the folder.

  4. Here’s an example of getting all folders in parent library:


    In this example we are creating a folder uder an album for images. The you can use the GetAllFolders method of the LibrariesManager by specifying the library as a parameter in order to find all folder under a specific library.

  5. Here’s an example of getting all folders in parent folder:


    This example is similar to number 4. However this time we have two folders with parent-child relationship within them. So the searchResult will return 2 folders in the end.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?