This topic explains how to delete albums. The examples below show you how to delete all of the available albums or how to delete only a specific album by its ID.
When deleting a specific album by its ID, you must perform the following:
Get the album.
First, get an instance of the album that corresponds to the specified ID.
Delete the album.
Mark the album to be deleted and save the changes.
The following code deletes an album by its ID.
Native API
First, you get an instance of the LibrariesManager class. Then, you get the album with the specified ID. To mark the album to be deleted, you call the DeleteAlbum method of the manager with the instance of the album as an argument. Finally, you save the changes.
Fluent API
First, you get the singular facade of the album with the specified ID. To mark the album to be deleted, you call the Delete method of the facade. Finally, you call SaveChanges.
When deleting all albums, you must perform the following:
Get all albums.
Get instances of the available albums.
Delete each album in the collection.
Iterate through the collection and delete each album.
The following code deletes all albums.
First, you get an instance of the LibrariesManager class. Then, you get all of the available albums. You iterate through the collection and mark each album to be deleted. Finally, you save the changes.
First, you get the plural albums facade. To mark each album to be deleted, you call the Delete 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.
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.
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.
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.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important