1

I am trying to remove and replace the "Delete this site" on Site settings page. Can anyone see what is wrong?

My current code looks like this:

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

  <CustomAction
    Description="Replaces the 'Delete this site'"
    Title="REPLACE"
    Id="{E538E8C7-65DA-454E-AD87-4A603B6CC569}"
    GroupId="SiteAdministration" 
    Location="Microsoft.SharePoint.SiteSettings"
    xmlns="http://schemas.microsoft.com/sharepoint/"
    >
  </CustomAction>

</Elements>

This gives me the following layout. "Delete this site" is still visable and "REPLACE" is in the wrong place.

enter image description here

I followed the instructions on the following site but the post is old: https://social.msdn.microsoft.com/Forums/office/en-US/575d5228-0ac5-4a1b-a435-da35b9392706/disable-delete-this-site-option?forum=sharepointcustomizationlegacy

The "Delete this site" link is under the "Site Actions" heading. However, on Microsoft's "Default Custom Action Locations and IDs" page there is not a "Site Actions" group: https://msdn.microsoft.com/en-us/library/office/bb802730.aspx enter image description here

1 Answer 1

2
  • To hide the standard "Delete this site", try to set the GroupId to SiteTasks: SiteAdministration is for SP2007, while in SP2010/2013, the link has moved to the section "Site Actions".
  • The same applies for your new custom action.

So, you should have now:

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

  <CustomAction
    Description="Replaces the 'Delete this site'"
    Title="REPLACE"
    Id="{E538E8C7-65DA-454E-AD87-4A603B6CC569}"
    GroupId="SiteTasks" 
    Location="Microsoft.SharePoint.SiteSettings"
    >
  </CustomAction>

</Elements>

(also, I removed the xmlns attribute as I don't think it's needed/correct).

3
  • You are correct on all accounts. How did you know about the SiteTasks GroupId? The 2013 page from Microsoft doesn't mention that GroupId, is there a more complete list out there?
    – amsackett
    Apr 11, 2016 at 17:32
  • 1
    I looked for DeleteWeb in the hive. I've shut-down my VM right now, so I can't get the exact path of the file...
    – Evariste
    Apr 11, 2016 at 17:41
  • These files are pretty good: \15\TEMPLATE\FEATURES\SiteSettings\SiteSettings.xml and \15\TEMPLATE\FEATURES\AdminLinks\Applications.xml
    – amsackett
    Apr 12, 2016 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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