Tips and Tricks: Deleting a site that has subsites (yes, you can, despite what the error message says)
One of the first things I have students do in an End User SharePoint Workshop is to create a test environment so they can play in a sandbox without blowing away their production environment. (”Who, me?” I know, I know. YOU would never implement untested changes in a production environment, but I guarantee you the person sitting in your chair ten seconds ago would.)
Let’s say you have setup a site to use as a testing environment and are ready to kill it because you’ve finished this phase of testing. The site contains several subsites, maybe a blog or two and a few workspaces. Have you ever tried to delete a site like that and gotten this message: “Error deleting Web site “/sites/TestEnvironment/YourSite”. You can’t delete a site that has subsites.”
You probably went through the process of trying to delete the test site from the Site Admin screen using these steps…
- Site Actions -> Site Settings
- Site Administration: Delete this site
- Delete This Site: Delete button
- Are you sure you want to permanently delete this Web site and all it contents?: OK
- Error deleting Web site “/sites/TestEnvironment/YourSite”. You can’t delete a site that has subsites
Other than the poorly designed workflow that would let you get all the way to the end before displaying an error message, the message itself is incorrect. You can delete a site that has subsites. You just have to do it from a different interface.
Now try it this way…
- Site Actions -> Site Settings
- Site Administration: Content and Structure
- In the left column, move to the parent of the main site to be deleted
- In the right column, choose the site to be deleted (YourSite in our example)
- Menu: Actions -> Delete
- Deleting the selected sites will permanently delete all content and user information. All subsites in this site will also be permanently lost. Do you want to continue?: OK
Relatively painless, right? Now you have no excuses for not creating a test environment.
I created a scheduled task that runs nightly and executes an exe that handles this for me.
The executable deletes all sites below the demo site(including their subsites) using a recursive delete function and creates 15 demo sites under the training site. Since this runs every night automatically we don’t run into issues with the users creating more on the demo site than they should.
Jason,
Yup, you’ve got a good solution. The problem is most of my clients are basic End Users of SharePoint, have no coding ability and definitely don’t have access to the command line on the server!
At an administative production level, what you propose is great. From a daily End User perspective, the ability to manage structure and content through the web interface is about all they are ready to handle.
Thanks for the input.
Mark
Beware, your tip works only on a MOSS Web Application not a WSS Web Application
…
Renaud – Thanks for the tip. All my clients are using MOSS, so your observation will help all those just running WSS.
Regards,
Mark
how crazy is that!?
ahh SharePoint…
Sweet!
I use MOSS 2007, but I cannot find Content and Structure under Site Administration. Wonder why ?
Waiting for a hint…. :(
“I use MOSS 2007, but I cannot find Content and Structure under Site Administration. Wonder why ?”
If you don’t have the publishing feature turned on at the top level site you will not see the manage content and structure link.
GOTO Site Settings > site collection features > Active > Publishing Infrastructure >
GOTO Site Settings > site features > Active > Publishing feature >
I am running WSS 3.0 and ran into the same problem today. If you go to the top level site settings and click on Site Hierarchy, it’ll let you manage the orphaned sites. ie DELETE THEM!
Thanks for posting this, one erroneously created site has now been deleted.
Thank you
Tried both of these method on a 2010 farm and cannot move beyond the error. What am I missing or what are ya’ll smoking??