Create folders inside libraries

  1. The following code creates a folder under a specified parent by parent

First, you get an instance of the 
LibrariesManager class. Then create an album. See here more info for For developers: Create image librariesTo create the album, you call the CreateAlbum method of the LibrariesManager class. You can create an album with either predefined or auto-generated ID depending on which overload of the method you use. Then, you set the properties of the album object. In our sample we are only setting the Title property. Finally, to save the album, you call the SaveChanges method of the manager.

Then we create a folder using the CreateFolder method of the LibrariesManager by using the album created in the previous step as a parameter. Folders have the following properties:

- Id
- Title
- Description
- UrlName
- ParentId

In our example we are not setting the Id, leaving it to be created automatically, set the Title, Description and UrlName. Finally you have to call the SaveChanges method of the manager in order to save the folder.

2. This example creates new folder under a specified parent by specifying folder id and parent:

Here we are creating an album first similar to the first example and later we are creating  a folder by specifying id and album. 

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?

Next article

Get folders