Hide SharePoint Ribbon Items

To hide a menu item from the SharePoint ribbon add a custom action to a module in your Visual Studio SharePoint project:

<CustomAction
Id="CustomIdentifier.Ribbon.Documents.New.NewFolder.Hide"
Location="CommandUI.Ribbon" RegistrationType="ContentType" RegistrationId="0x">
  <CommandUIExtension>
    <CommandUIDefinitions>
      <CommandUIDefinition Location="Ribbon.Documents.New.NewFolder">
      </CommandUIDefinition>
    </CommandUIDefinitions>
  </CommandUIExtension>
</CustomAction>

The example above will hide the New Folder ribbon menu item for all document libraries.

Using a RegistrationType of ContentType and RegistrationId of 0x means it will be applied to all items.

The important part of the custom action is specifying the item’s location, which above is:

<CommandUIDefinition Location="Ribbon.Documents.New.NewFolder">
</CommandUIDefinition>

Notice there’s nothing defined within the CommandUIDefinition, doing this hides the menu item.

An easy way to find out the Location identifier is to open the list or library in IE and open the Developer Tools ad-on – F12 key by default. Using Select item by click (ctrl + b) select the ribbon item you want and the Location identifier will be in the id attribute of the selected item, as shown below:

Ribbon Identifier

The identifier is everything up to but not including the last dash character (-), so in this example it is Ribbon.Documents.New.NewFolder and not Ribbon.Documents.New.NewFolder-Large.

This entry was posted in SharePoint and tagged , . Bookmark the permalink.
0 0 votes
Article Rating
Subscribe
Notify of
guest

Solve the maths problem shown below before posting: *

1 Comment
Inline Feedbacks
View all comments
Aditya Reddy

Thanks. This was worked like charm. Appreciated by my leads too.