10.0
  1. Delete an item and its descendants

Delete the descendants of an item

You can use the Sitecore.Data.Items.Item.DeleteChildren() method to delete the descendants of an item. For example, to delete the descendants of the /Sitecore/Content/Home item in the Master database:


Sitecore.Data.Database master = Sitecore.Configuration.Factory.GetDatabase("master");

Sitecore.Data.Items.Item sample = master.GetItem("/sitecore/content/home/sample");

sample.DeleteChildren();
If you have suggestions for improving this article, let us know!