Monday, March 12, 2012

Disable “Open in Windows Explorer” on SharePoint

Ribbon is introduced in SharePoint 2010. We can easily make customization it by using the Feature Infrastructure. In order to hide a button, say the “Open with Explorer”, "Download Copy" ...etc 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"
Title="DisableRibbonButton"
Description="DisableRibbonButton"
Version="1.0.0.0"
Scope="Web"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="Manifest.xml" />
</ElementManifests>
</Feature>

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

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="RemoveExplorerButton"
Location="CommandUI.Ribbon"
RegistrationType="List"
RegistrationId="101">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.Library.Actions.OpenWithExplorer" />
</CommandUIDefinitions>
</CommandUIExtension>
</CustomAction>
</Elements>

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>

No comments:

Post a Comment