Let’s go, I created and deploy this feature (http://msdn2.microsoft.com/en-us/library/ms414790.aspx) :
Feature.xml
<?xml version="1.0" encoding="utf-8" ?>
<Feature Id="GUID"
Title="Hide open in explorer action"
Description="Hide open in explorer action"
Version="1.0.0.0"
Scope="Site"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="manifest.xml" />
</ElementManifests>
</Feature>
Manifest.xml
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<HideCustomAction
Id="HideOpenInExplorer"
HideActionId="OpenInExplorer"
GroupId="ActionsMenu"
Location="Microsoft.SharePoint.StandardMenu" />
</Elements>
Unfortunately this method does not work. Only the actions listing on http://msdn2.microsoft.com/en-us/library/bb802730.aspx could be hidden with the HideCustomAction element.
The template override method
After some searching, I found another solution: Override the ToolbarActionsMenu template
Simply copy the defaultTemplate.ascx file in the “<12Hive>\TEMPLATE\CONTROLTEMPLATES” directory and rename it, for example myDefaultTemplate.ascx.
In this file remove all the Sharepoint:RenderingTemplate excepts the Sharepoint:RenderingTemplate ID=”ToolbarActionMenu”
In ToolbarActionMenu section remove : SharePoint:MenuItemTemplate ID=”OpenInExplorer”. The file must look like this :
<%@ Control Language="C#" AutoEventWireup="false" %>
<%@Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@Register TagPrefix="SharePoint" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" namespace="Microsoft.SharePoint.WebControls"%>
<%@Register TagPrefix="SPHttpUtility" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" namespace="Microsoft.SharePoint.Utilities"%>
<%@ Register TagPrefix="wssuc" TagName="ToolBar" src="~/_controltemplates/ToolBar.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ToolBarButton" src="~/_controltemplates/ToolBarButton.ascx" %>
<SharePoint:RenderingTemplate ID="ToolbarActionsMenu" runat="server">
<Template>
<SharePoint:FeatureMenuTemplate runat="server"
FeatureScope="Site"
Location="Microsoft.SharePoint.StandardMenu"
GroupId="ActionsMenu"
UseShortId="true"
>
<SharePoint:MenuItemTemplate
ID="EditInGridButton"
ImageUrl="/_layouts/images/menudatasheet.gif"
PermissionsString="UseRemoteAPIs"
MenuGroupId="200"
Sequence="200"
UseShortId="true"
runat="server"/>
This section must be delete
<SharePoint:MenuItemTemplate
ID="OpenInExplorer"
Text="<%$Resources:wss,ToolBarMenuItemOpenInExplorer%>"
Description="<%$Resources:wss,ToolBarMenuItemOpenInExplorerDescription%>"
PermissionsString="UseClientIntegration"
PermissionContext="CurrentList"
MenuGroupId="200"
Sequence="300"
UseShortId="true"
runat="server"/> <SharePoint:MenuItemTemplate
ID="ChangeOrder"
Text="<%$Resources:wss,ToolBarMenuItemChangeOrder%>"
Description="<%$Resources:wss,ToolBarMenuItemChangeOrderDescription%>"
MenuGroupId="200"
Sequence="400"
UseShortId="true"
runat="server"/>
<SharePoint:MenuItemTemplate
ID="ShowInStdViewButton"
Text="<%$Resources:wss,ToolBarMenuItemShowInStdView%>"
Description="<%$Resources:wss,ToolBarMenuItemShowInStdViewDescription%>"
MenuGroupId="300"
Sequence="100"
UseShortId="true"
runat="server"/>
<SharePoint:MenuItemTemplate
ID="NewRowButton"
Text="<%$Resources:wss,ToolBarMenuItemNewRow%>"
Description="<%$Resources:wss,ToolBarMenuItemNewRowDescription%>"
PermissionsString="AddListItems"
PermissionContext="CurrentList"
MenuGroupId="300"
Sequence="200"
UseShortId="true"
runat="server"/>
<SharePoint:MenuItemTemplate
ID="TaskPaneButton"
Text="<%$Resources:wss,ToolBarMenuItemTaskPane%>"
Description="<%$Resources:wss,ToolBarMenuItemTaskPaneDescription%>"
MenuGroupId="300"
Sequence="300"
UseShortId="true"
runat="server"/>
<SharePoint:MenuItemTemplate
ID="TotalsButton"
Text="<%$Resources:wss,ToolBarMenuItemTotals%>"
Description="<%$Resources:wss,ToolBarMenuItemTotalsDescription%>"
MenuGroupId="300"
Sequence="400"
UseShortId="true"
runat="server"/>
<SharePoint:MenuItemTemplate
ID="RefreshDataButton"
Text="<%$Resources:wss,ToolBarMenuItemRefreshData%>"
Description="<%$Resources:wss,ToolBarMenuItemRefreshDataDescription%>"
MenuGroupId="300"
Sequence="500"
UseShortId="true"
runat="server"/>
<SharePoint:MenuItemTemplate
ID="OfflineButton"
Description="<%$Resources:wss,ToolBarWorkOfflineOutlookDescription%>"
PermissionsString="UseClientIntegration"
PermissionContext="CurrentList"
MenuGroupId="400"
Sequence="100"
ImageUrl="/_layouts/images/MenuPIM.gif"
UseShortId="true"
runat="server"/>
<SharePoint:MenuItemTemplate
ID="ExportToSpreadsheet"
Text="<%$Resources:wss,ToolBarMenuItemExportToSpreadsheet%>"
Description="<%$Resources:wss,ToolBarMenuItemExportToSpreadsheetDescription%>"
PermissionsString="UseClientIntegration"
PermissionContext="CurrentList"
MenuGroupId="400"
Sequence="200"
ImageUrl="/_layouts/images/MenuSpreadsheet.gif"
UseShortId="true"
runat="server"/>
<SharePoint:MenuItemTemplate
ID="ExportToDatabase"
PermissionsString="UseClientIntegration"
PermissionContext="CurrentList"
MenuGroupId="400"
Sequence="300"
ImageUrl="/_layouts/images/MenuDatabase.gif"
UseShortId="true"
runat="server"/>
<SharePoint:MenuItemTemplate
ID="DiagramButton"
Description="<%$Resources:wss,ToolBarCreateDiagramDescription%>"
PermissionsString="UseClientIntegration"
PermissionContext="CurrentList"
MenuGroupId="400"
Sequence="500"
UseShortId="true"
runat="server"/>
<SharePoint:MenuItemTemplate
ID="ViewRSS"
Text="<%$Resources:wss,ToolBarMenuItemViewRSSFeed%>"
Description="<%$Resources:wss,ToolBarMenuItemViewRSSFeedDescription%>"
MenuGroupId="500"
Sequence="400"
ImageUrl="/_layouts/images/MenuRSS.gif"
UseShortId="true"
runat="server"/>
<SharePoint:MenuItemTemplate
ID="SubscribeButton"
Text="<%$Resources:wss,ToolBarMenuItemAlertMe%>"
Description="<%$Resources:wss,ToolBarMenuItemAlertMeDescription%>"
PermissionsString="CreateAlerts"
PermissionContext="CurrentList"
PermissionMode="Any"
MenuGroupId="500"
Sequence="500"
ImageUrl="/_layouts/images/MenuAlert.gif"
UseShortId="true"
runat="server"/>
<SharePoint:MenuItemTemplate
ID="AddToMyLinksButton"
Text="<%$Resources:wss,ToolBarMenuItemAddToMyLinks%>"
MenuGroupId="500"
Sequence="600"
UseShortId="true"
runat="server"/>
</SharePoint:FeatureMenuTemplate>
</Template>
</SharePoint:RenderingTemplate>
Finally, restart IIS.
It’s work. But I can use this method, because all the site collections on the server farm are affected and I need to hide this section for a specific site collection.
The js method
Since I didn’t found any solution, I decided to implement my custom solution. Then I tried to remove this menu with a custom JavaScript. After analyzing the Html source of the list web page, the open in explorer menu is render by a custom IE HTML Tag:
<ie:menuitem id="zz22_OpenInExplorer" type="option" …………… menuGroupId="200"></ie:menuitem>
So I wrote a custom JavaScript code to hide this element:
customBranding.js
function HideOpenInExplorer()
{
var viewInExplorer = document.getElementById("zz22_OpenInExplorer");
if (viewInExplorer != null)
{
if (viewInExplorer.parentNode != null)
viewInExplorer.parentNode.removeChild(viewInExplorer);
}
}
Then I created a custom master page to apply this JavaScript. I copied the default.master and rename to myCustomBranding.master. In the head section I added
<SharePoint:ScriptLink ID="ScriptLink2" language="javascript" name=" customBranding.js" runat="server" />
And at the bottom of the file, I call my custom js function:
<script language="javascript">
HideOpenInExplorer ();
</script>
</BODY>
</HTML>
Then I created a solution (a wsp file), to deploy my js file and deploy my custom master page in master gallery. Then I used the excellent master page picker (www.codeplex.com/SPMasterPicker) to change the master page on my WSS site.
It’s works!
There is this great blog by Jérémie Clabaut about hiding the "Open In Explorer"
Tracked: May 06, 19:26