Wednesday, March 11, 2009

Disable Site Deletion

Have you had a user delete a site, and then complain that it's gone? I have! The solution is to disable the ability to delete a site!

Simply add this line of code to the core.js, or application.master, or anywhere else that is going to get loaded by the settings.aspx page. There is probably a dozen places you could add this code.

NOTE: I haven't tested this out, but at worst, all it's going to do is find the Delete web link, and hide it on the page. It doesn't actually change the page, just the display of the page. You could disable javascript in your browser and it would re-appear.


This basically says, find the "Delete this site" link, and turn off the display of that row in the table.

If you do need to delete the site, you could always just go directly to the _layouts/deleteweb.aspx page on that site, and click to delete.

Hopefully this will save you a few headaches.

You could get fancy, and change the link's HREF to be a mailto: link to your
helpdesk or sys admins. That way, if they want to delete a site, they will have to send you an email. Then you simply remove everyone's permissions. They'll think it's deleted, but you could easily bring it back if you needed to.

Good Luck!

No comments: