Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

How to delete a website which is having subsites in sharepoint 2010? I dont like to go to down level and start up deleting? i would like to delele site and subsites at a time?

share|improve this question

4 Answers 4

Do you have the Publishing Infrastructure enabled? If so I believe you can do this from the Site Actions/Manage Content and Structure option. Just chose delete from the menu.

share|improve this answer

If you're trying to do this via the Object Model, then you're going to have to recurse down through the sites and delete from the bottom up.

I've put together a function to do this (see below). However, I've also put together a more integrated solution in the form of an extension method, which can be found on my blog. SPFix: Deleting a site with subsites programmatically

public static void DeleteWeb(SPWeb web)
    foreach (SPWeb subWeb in web.Webs)

share|improve this answer

Depends on how you want to remove the site and it's corresponding sub-sites, whether by Powershell or programatically.

If you are wanting to do this programatically, according to technet, you should be able to just use:

Remove-SPSite -Identity "http://sitename" -GradualDelete -Confirm:$False

Otherwise, the other code related snippet and link provided by @Stuart should work.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.