2

Using SharePoint 2010, how do I remove "New Site" from the Site Actions menu. I believe I can do this through permissions but would like to remove for all users (and replace with a custom action link).

Oddly, this is much more difficult than expected. I can apparently use HideCustomAction for some of the items but New Site seems to be a problem.

thx

1
  • So I figured out that the Site Action options are in the master page for the site. I can also edit the master page to remove that menu option or change the click event for it. I would like to remove/hide or change this menu option through a feature however. Is this possible?
    – dave
    Commented Nov 4, 2010 at 17:46

1 Answer 1

3

This was tough when I started doing it today. It is possible via feature using a CustomAction element in the elements.xml and some code. I tried a no-code solution but it was not possible.

 <CustomAction
        Id="HideCreateSiteInSiteActions"
        Location="Microsoft.SharePoint.StandardMenu"
        GroupId="SiteActions"
        Sequence="901"
        Title="Publishing SiteActions Menu Customization"
        ControlAssembly="Your Assembly full name"        ControlClass="your class full name">
  </CustomAction>

Following code would go in class:

public class YourClassName : WebControl
    {
        protected override void OnLoad(EventArgs e)
        {
            var siteActions = ToolBarMenuButton.GetMenuControl(this);
            siteActions.MenuControl.PreRender += (o, args) =>
            {
                var targetMenu = siteActions.GetMenuItem("MenuItem_CreateSite");
                if (targetMenu == null) return;
                siteActions.MenuControl.HiddenMenuItems.Add(targetMenu);
            };
        }        
    }

The scope of your feature would be "site". Also, don't forget to put SafeControl entry for your class in the web.config or it may not work.

Your Answer

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

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