Remove a menu group (or menu) from toolbar

To remove a whole menu group, this link has the answer:

To summarize it (in my understanding and language):

In \12\TEMPLATE\CONTROLTEMPLATES there are many templates. By just dropping a new template file (file name doesn’t seem to matter) with

<SharePoint:RenderingTemplate ID=”DocumentLibraryViewToolBar” runat=”server”>

it will override the default template defined in DefaultTemplates.ascx. So even DefaultTemplates.ascx still has that menu groups, it will be hidden on UI. IISRESET or application pool need to be recycled before this takes effect.

However, this \12\TEMPLATE\CONTROLTEMPLATES folder is shared by all sites installed on same server. What if other sites don’t want to hide that menu group? Here is my trick: make a copy of that “ControlTemplates” folder and put the customized file there. Then go to InetMgr and change the virtual directory path to point to the new folder for those applications that want this change.

This is the file to hide “New” menu group in Doc Lib page toolbar:


<%@ Control Language=”C#” AutoEventWireup=”false” %>
<%@Assembly Name=”Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
<%@Register TagPrefix=”SharePoint” Assembly=”Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c” namespace=”Microsoft.SharePoint.WebControls”%>
<%@Register TagPrefix=”SPHttpUtility” Assembly=”Microsoft.SharePoint, Version=, 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=”DocumentLibraryViewToolBar” runat=”server”>
<wssuc:ToolBar CssClass=”ms-menutoolbar” EnableViewState=”false” id=”toolBarTbl” ButtonSeparator=”<img src=’/_layouts/images/blank.gif’ alt=”>” RightButtonSeparator=” ” runat=”server”>
<SharePoint:UploadMenu AccessKey=”<%$Resources:wss,tb_UploadMenu_AK%>” runat=”server”/>
<SharePoint:ActionsMenu AccessKey=”<%$Resources:wss,tb_ActionsMenu_AK%>” runat=”server”/>
<SharePoint:SettingsMenu AccessKey=”<%$Resources:wss,tb_SettingsMenu_AK%>” runat=”server”/>
<SharePoint:PagingButton runat=”server”/>
<SharePoint:ListViewSelector runat=”server”/>


When it comes to removing a particular menu from a menu group, things didn’t work as expected. You are supposed to do that through a Feature and use <HideCustomAction> to hide a particular menu. There is no where you can get a complete list of IDs of all the menu items. I tried this:

GroupId = “ActionsMenu”
HideActionId = “ExportToSpreadsheet”
Id = “HideExportToSpreadSheetMenu”
Location = “Microsoft.SharePoint.StandardMenu”>

But it didn’t work. I tried a few other combinations of Export To Spreadsheet and none of worked. Google search only returns similar failed attempts. (This page gives you the group IDs).

My workaround is to directly edit DefaultTemplates.ascx file in ControlTemplates folder. Then it’s permanently gone. Backup the file before you make change. Follow aforementioned trick if other sites in same server don’t want the change.

This entry was posted in SharePoint and tagged . Bookmark the permalink.

10 Responses to Remove a menu group (or menu) from toolbar

  1. Gene says:

    Hope you can help me with a little point… When I directly edit DefaultTemplates.ascx in the ControlTemplates folder, the old code still comes up when I refresh the page in the browser. I’m doing an IISReset and the page in question is not ghosted. Any ideas? Thanks!

  2. Sal says:

    I am having the same issue after modifying defaulttemplates.ascx. I restarted IIS, App Pool, re-boot. Still changes did not take effect. If you resolved it, can you share the solution? Thanks!!

  3. Geale says:

    I also had the same problems as Gene and Sal but found if my new ascx was named with the letters ‘DF….’ to ‘Z’ it would work but not if it was named ‘A’ to ‘DE’. Maybe the files are read alphabetically and then its overridden as the DefaultTemplates.ascx is loaded after the custom one and the changes are overridden.

  4. svarukala says:

    That was easy. I was worried I might have to spend considerable time on this piece. Thx!

  5. Mukesh Ajmera says:

    Is there any way how to Hide Edit Properties in Document Library ?

  6. Tracy says:

    Did you test your method for “removing a particular menu from a menu group”? I had a need to remove the ‘Open in Explorer’ option from the document library Actions menu. Upon initial view of the DefaultTemplates.ascx file – I easily located the ‘OpenInExplorer’ SharePoint MenuItemTemplate and assumed (based upon your posting and others like it), that it would be a simple matter of removing that item, and resetting IIS. Well, it’s not:

    Were you referring to a particular subset of menu items for the method you’ve mentioned here?

  7. skittles says:

    Check out Sharepoint Manager 2007… you should be able to find the menu you are looking at by looking at internals of Sharepoint objects.

  8. Sanket Shah says:


    Very nice article and good information!!

    I have different situation from this and I am looking for solution, can you please help me for this?

    I would like to remove menu items “Edit Item” from specific custom list, if I go with above solution then it will remove menu options from all custom list, but what I need to do for removing option from only one list.


    Is there any way in which I can change URL of “Edit Item” page from EditItem.aspx to my layouts custom ASPX page? In SP designer, while changing page name (supporting files) from custom list, I can’t see files from layouts folder ..

    Actually finally I am looking for to give my custom ASPX page URL into “Edit Item” option or hide that option from specific list and add new custom action which will point to new layouts page, I already added new custom action into Edit Control block. But I am facing some of the challenges with other items.

    Thank you very much for your time.

    Sanket Shah

  9. Sumit says:

    Not working for me.
    I want to remove “Add to My Links” from Actions menu

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s