Sitefinity CMS

Deleting Categories Send comments on this topic.
See Also
Developing with Sitefinity > Modules > Modules API > Generic Content > Categories > Deleting Categories

Glossary Item Box

There is one method for deleting a category:

  • DeleteCategory(Guid categoryID) - Pass the ID of the category that will be deleted 

Delete a category by specified ID:

DeleteCategory(Guid categoryID) Copy Code
// create new instance of ContentManager
Telerik.Cms.Engine.ContentManager contentManager = new Telerik.Cms.Engine.ContentManager();
// get all categories
IList listOfCategories = contentManager.GetCategories();
if (listOfCategories.Count > 0)
{
   
// get the fourth category
   
Telerik.Cms.Engine.ICategory fourthCategory = contentManager.GetCategory(((Telerik.Cms.Engine.ICategory)listOfCategories[4]).ID);
   
// delete the category with passed ID
   
contentManager.DeleteCategory(fourthCategory.ID);
}

 

See Also