IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
This topic explains how to delete blogs. The examples below show you how to delete all of the available blogs or how to delete only a specific blog by its ID.
When deleting a specific blog by its ID, you must perform the following:
The following code deletes a blog by its ID:
Native API
First, you get an instance of the BlogsManager class. Then, you get the blog with the specified ID. To mark the blog to be deleted, you call the DeleteBlog method of the manager with the instance of the blog as an argument. Finally, you save the changes.
BlogsManager
DeleteBlog
Fluent API
First, you get the singular facade of the blog with the specified ID. To mark the blog to be deleted, you call the Delete method of the facade. Finally, you call SaveChanges.
Delete
SaveChanges
When deleting all blogs, you must perform the following:
The following code deletes all blogs.
First, you get an instance of the BlogsManager class. Then, you get all of the available blogs. You iterate through the collection and mark each blog to be deleted. Finally, you save the changes.
First, you get the plural blogs facade. To mark each blog to be deleted, you call the Delete method of the facade. Finally, you save the changes.
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important