1

We need to avoid our users, who are "site owners", delete his site collection by mistake.

The only method I think of is use Jquery to hide/disable the "Delete this site" button. Do we have other way to do so? For example disable the delete site permission. Thanks.

Mark

5

A WebDeleting event can be used to prevent users event if they are owners to delete a site collection. Example:

public override void WebDeleting(SPWebEventProperties properties)
{
    properties.Status = SPEventReceiverStatus.CancelWithError;
    properties.ErrorMessage = "This site cannot be deleted.";
    properties.Cancel = true;
}

See this for more info: http://blogs.technet.com/b/sharepointdevelopersupport/archive/2012/09/07/how-to-prevent-site-deletion-with-a-custom-event-receiver.aspx

1

Other option is to create a HideCustomAction to hide the "Delete a site" action.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <HideCustomAction
    Id="Customization"
    GroupId = "SiteTasks"
    HideActionId = "DeleteWeb"
    Location = "Microsoft.SharePoint.SiteSettings">
 </HideCustomAction>
</Elements>

For a list of locations MSDN

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.