Wednesday, 3 February 2010

Remove button from the Ribbon in SharePoint 2010

In SharePoint 2007, I have quite a few requests from different client to remove button from the document list view, such as the “Edit in Datasheet” and “Open with Windows Explorer” button. I was able to solve the problem by writing a Javascript to hide the button.

Ribbon is introduced in SharePoint 2010. We can easily make customization it by using the Feature Infrastructure. For example, we can create a new button, delete an existing button, as well as replacing an existing button. Hence I can easily get around with the problem that I had in SharePoint 2007.

In order to hide a button, say the “Open with Explorer”, we will need to create a feature. We start by creating a new folder called “DisableRibbonButton”. Create a new file called “feature.xml” in the new folder and insert the following XML into the file

<?xml version="1.0" encoding="utf-8" ?>
<Feature Id="33057CD9-6D14-45c9-83ED-5E1FE066AC92"
    <ElementManifest Location="Manifest.xml" />

Then create another file called “Manifest.xml” and insert the following XML:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="">
          Location="Ribbon.Library.Actions.OpenWithExplorer" />

The above XML is to remove the “Open with Explorer” button from the Ribbon for all list with type ID 101, hence all the Document Library type. The location “Ribbon.Library.Actions.OpenWithExplorer” is the ID that is registered in the default Ribbon button XML, which can be found in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\GLOBAL\XML\CMDUI.XML”

Now we will execute the following Cmdlet using the “SharePoint 2010 Management Shell” to install and active the feature:

Install-SPFeature DisableRibbonButton

Enable-SPFeature DisableRibbonButton –url http://<servername>

After that, go to any document library in your site, click the “Library” tab at the top and you should see the “Open with Explorer” button is now disappeared from the Ribbon.


Uzair said...

Can we remove some buttons from ribbon for a particular document library?

Pavan Kumar said...

I will be needing the same but it should get enabled for administrators.

I s That Possible?

Anonymous said...

Hi, I have deleted a button of my ribbon, but now even when I disable my feature the button is still deleted.

Do you know how to fix this problem ?


Becks said...

Although the powershell scripts appeared to run, this didn't work for me :o(

Becks said...

Ooops, sorry, please don't authorise my previous comment. It worked perfectly. Needed an iisreset :o)