I have used the example of hiding the "Theme" button in Site Settings (as for corporate intranets with strict branding, this is quite a comment request. I would like to show you though how to not only hide specific menus, but how to hide whole sections of the Site Settings menu and other SharePoint menus too!
This all hinges on the HideCustomAction element which you can use in Features.
There are actually some pretty good (MSDN) references:
Default Custom Action Locations & IDs
How to: Hide a Menu Item in the ECB from SharePoint List Items
John Holliday - SharePoint Custom Action Identifiers
And a cross post, for completion:
How to: Add Actions to the User Interface
So What about this HideCustomAction thing then?
Ahhh yes, got carried away with MSDN references …
First off, you will need a feature (scoped at the Site Level)
Feature File (Feature.xml, don't forget to put your own GUID value in)
<?xml version="1.0" encoding="utf-8" ?>
<Feature Id="GUID"
Title="Hide UI Custom Actions"
Description="This example shows how you can hide menus inside Windows SharePoint Services."
Version="1.0.0.0"
Scope="Site"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="HideUICustomActions.xml" />
</ElementManifests>
</Feature>
Elements File (HideUICustomActions.xml)
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<HideCustomAction
Id="HideThemeLink"
GroupId="Customization"
HideActionId="Theme"
Location="Microsoft.SharePoint.SiteSettings"
</HideCustomAction>
</Elements>
That will give you a feature which will remove the "Theme" links from the Site Settings menu. Now, let me quickly walk you through what the element file is composed of (hopefully the Feature file should be familiar enough).
HideCustomAction – This element defines a new custom action which we want to hide.
Id – This is optional (but recommended), used to identify this specific "hide" action from others.
GroupId – This is the GroupId value for the Custom Action that you want to hide.
HideActionId – This is the Id value in the Custom Action that you want to hide.
Location – This is the location value from the Custom Action that you want to hide.
If you want to find custom actions (and therefore access all of these values) then simply open up the Features folder (..\12\Templates\Features) and do a search for the phrase "CustomAction" in the files. You should find all of the CustomActions that are provided out of the box, and subsequently the ability to hide them if you want to! Exactly the same thing applies to Site Settings, so if you wanted to hide (for example) the "Themes" menu then you can find the Custom Action in the standard "SiteSettings" feature.
Enjoy, and let me know how you get on!
Yeah you could do that, but that will apply your changes to all applications in your farm instead of to just a single web application.
ReplyDelete