Pages

3/22/2009

SharePoint: How to Hide Delete Site

Site Owners can delete their own sites. A cool power user feature, but… do you trust them with this power?

Before we go on, even if you remove the ability to delete a site, you should still install the site undelete tool from CodePlex. Just in case, you know…

Here’s two ways I’ve thought of to deal with Delete Site…

Replace the Delete Site page

Hide the Delete Site link using a feature

(both require access to the web servers)

Idea #1 – Get rid of the site delete page!

Well, not get rid of it, but hide it. The site delete page is in the 12 hive: …\12\template\layout\deleteweb.apx. The quickest way to make this page unavailable is to just rename it, say to deletewebforadminonly.aspx. You can then still use the page to delete a site by going directly to http://servername/sitename/_layouts/deletewebforadminonly.aspx.

What will the site owners see if they click the Delete Site link? The standard SharePoint “Unknown Error” error page. Want something better? After renaming the deleteweb page create a new deleteweb page with something like “To delete this site please contact your SharePoint Administrator at 123-1234”.

A SharePoint feature can be enabled and disabled at any time without modifying a site or page. Using this feature described here will hide the Delete Site command from your Site Owners, but they can still go directly to the deletesite.aspx page if they can guess the URL.

Create these files in the Features folder with a name like: …\12\Features\HideDeleteSite

In the feature.xml file pick the Scope you would like to use: Farm, WebApplication, Site or Web.