Create image libraries

When creating an album, you must perform the following steps:

  1. Check whether the album already exists.

    Before you create the album, you must check whether an album with the same ID already exists.

  2. Create the album.

    If the album does not exist, you create a new album with the specified ID.

  3. Set the required properties.

    When creating a new album, it is recommended to set at least the following properties:

    • Title
    • LastModified
    • DateCreated
    • UrlName

    You can also set any other properties in this step.

  4. Save the album.

    Save all changes that you have made to the album.

The example below shows you how to create an album with predefined ID.

Creating an album with predefined ID

The following code creates an album with the specified ID and Title.

Native API


First, you get an instance of the LibrariesManager class. You check whether an album with the same ID already exists. To create the album, you call the CreateAlbum method of the LibrariesManager class and pass the specified ID. 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. It is recommended to set at least the following properties: TitleUrlNameLastModifiedDateCreated. Finally, to save the album, you call theSaveChanges method of the manager.

Fluent API


First, you check whether an album with the same ID already exists. To create the album, you call the CreateNew method of the singular album facade. You can create an album with either predefined or auto-generated ID depending on which overload of the method you use. To set the properties of the album, you call the Do method of the facade. Finally, you save the changes.

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?