Delete the descendants of an item
Version: 10.4
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:
RequestResponse
Sitecore.Data.Database master = Sitecore.Configuration.Factory.GetDatabase("master");
Sitecore.Data.Items.Item sample = master.GetItem("/sitecore/content/home/sample");
sample.DeleteChildren();Note
You cannot delete items that are stored in resource files. If you have copied an item from a resource file to the database, Sitecore deletes it from the database and restores it from the resource file.