Code Sample : How to programmatically delete a web (and it’s child webs)

If you have ever tried to delete a web either in code, or via the SharePoint GUI, then you will note that isn’t possible if the web has one or more child webs. (or grandchildren). To delete a web, you must first delete it’s subwebs.

The code below illustrates this in C# :

Here are some recent posts you may find interesting: