SharePoint 2010: Unable to delete site/web after SP1

While doing some testing after upgrading my dev machine to SP1, I ran into two separate issues when trying to delete a web through the UI by using the “Sites and Workspaces” link in Site Settings. Deleting through powershell worked fine.

Issue #1: Specified method is not supported

This specific error was occurring only on one of my web applications. I had just attached the database for this application to my existing SharePoint 2010 SP1 environment. The error will appear if the database for your web application needs to be updated.

To check if your database needs to be updated, open Central Administration and navigate to “Upgrade and Migration” -> “Review database status”. All of your databases should show a status of “No action required”. If the application you are experiencing the error on is running in compatibility mode, you’ll need to update it using PowerShell. To do this, first get the GUID ID of the database in question by running the following powershell and then copying the ID of the database you wish to upgrade:

Get-SPContentDatabase

Then run the following powershell to upgrade the database using the ID you just copied.

Upgrade-SPContentDatabase -Identity YourDatabaseIDGoesHere

Issue #2: There is no Web named “/YourWebName”

Once my above issue was resolved on the one misbehaving web application, I had consistent behavior across all web applications when trying to delete a web… or so I thought. Turns out – if I create a web right off of the site collection (the RootWeb), then I can successfully delete it using the “Sites and Workspaces” page. Also – I can delete the web successfully if I navigate to the web I want to delete and then use the “Delete this Site” link. This behavior was consistent in a SharePoint 2010 SP1 environment and SharePoint 2010 SP1 + June Cumulative Update. What’s going on here?

Time to open up Reflector. The offending code comes from the Microsoft.SharePoint.ApplicationPages dll located in the virtual directory/_app_bin of your web application. Specifically, the DeleteWebPage class. Here’s the code:

The offending line, using the OpenWeb function, gets passed “/DeleteMe” if your web’s name is “DeleteMe”. This will work fine if the web’s url starting from the site collection is “/DeleteMe”. But if your web is a subweb of a subweb (e.g. http://yoursite/someweb/DeleteMe) then it will fail and throw the exception. This looks to be a bug in SP1 and June CU… so we’ll have to wait for MS to fix the issue before we can go this route to delete a web. Instead – use PowerShell to delete the web or navigate to the web you wish to delete and use the “Delete this Site” link.

15 thoughts on “SharePoint 2010: Unable to delete site/web after SP1

  1. Paweł

    Thank you man :) . I had exactly the same problem. Upgrading the content database solves the problem!
    Cheers!

    Reply
  2. LoriH

    Unfortunately, this is an issue pre-SP1 as well, and I’m having a problem upgrading the database. I get a lockout error on my SP1 box and an error that the site collection does not exist on my pre-SP1 box. Not a happy camper.

    Reply
    1. Jon Badgett Post author

      Can’t say I’ve seen the issue pre-SP1. That page’s code was changed due to the addition of the site recycle bin. Have you tried performing the delete through powershell?

      Reply
  3. Pingback: SharePoint 2010: Unable to delete site/web after SP1 - Agusto Xaverius P Sipahutar

  4. Pingback: SharePoint 2010: Unable to delete site/web after SP1 - Agusto Xaverius

  5. Bendecko

    Thanks so much. I’m new to sharepoint, and this was driving me nuts. To delete the site via powershell issue this command.

    Remove-SPWeb “http://foobar/Test” -Confirm:$false

    Reply
    1. Jon Badgett Post author

      Microsoft confirmed it as a bug whenever we found and reported it. I haven’t tested any newer builds of SP2010 to see if the issue has been resolved, however.

      Reply
  6. Pingback: SP1 & the June CU bug discovered when you try to Delete sites -

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>