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. 

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?

Next article

Get folders