If I understand you correctly, it can be done by using a SharePoint Feature.
You can create and deploy a SharePoint Feature which has a web event receiver. In this event receiver you can override the SiteDeleting
method and cancel the request to delete a site collection by changing the value of the property Cancel
of the parameter to true
. This would return an error for anyone trying to delete the site collection. You can also add an error message.
For example:
/// <summary>
/// A site collection is being deleted
/// </summary>
public override void SiteDeleting(SPWebEventProperties properties)
{
base.SiteDeleting(properties);
if(/*some condition*/)
{
properties.Cancel = true;
properties.ErrorMessage = "This site collection should never be deleted.";
}
}
You can check for a specific name or a specific URL.
Of course, it would still be possible to deactivate the feature and still delete the site. But at least it would prevent it from being deleted accidentally.