Sitecore 5.0 API

Item.DeleteChildren Method 

Deletes all subitems.

[Visual Basic]
Public Function DeleteChildren() As Integer
[C#]
public int DeleteChildren();

Return Value

The number of child items deleted.

Remarks

The items are permanently deleted.

Example

The following example permanently deletes the subitems of an item from the database.

{{{
public bool DeleteSubItem(Item item, string userResponse) {
  if (userResponse == "yes") {
    item.DeleteChildren();
    return true;
  }
  return false;
}
}}}

See Also

Item Class | Sitecore.Data.Items Namespace