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


<Feature Id="33057CD9-6D14-45c9-83ED-5E1FE066AC92"
Title=”DisableRibbonButton”
Description=”DisableRibbonButton”
Version=”1.0.0.0″
Scope=”Web”
xmlns=”http://schemas.microsoft.com/sharepoint/”&gt;

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

<CustomAction
Id=”RemoveExplorerButton”
Location=”CommandUI.Ribbon”
RegistrationType=”List”
RegistrationId=”101″>

<CommandUIDefinition
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”

Once you have created the above xml files…you will need to copy them to a folder called DisableRibbonButton in the Features folder in the 14 hive.

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://

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.

image

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s