How to Remove or hiding items in List toolbar in Sharepoint Server 2007

Last week one ISV asked me that he wanted to hide/remove the “New” or “Actions” menu of the Document Library Toolbar in Sharepoint 2007, maybe this would be great needs for you, now I post the way to realize this:

To realize this, you need to override the .ascx based toolbar templates by using a custom template that overrides a toolbar, and thereby customize a toolbar. Please save the following code into nonewbuttonfordoclibtemplates.ascx, and then drop it into C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES and IISRESET, you should be missing the New button on your document library toolbars.


<%@ 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=”&nbsp;&nbsp;” 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”/>






Comments (51)

  1. Hi,

    Great post and very insightful.  It’s amazing how your single post has turned out to be more helpful than any article I have read on MSDN about customizing styles.  Maybe I have been looking in the wrong place (but I have been looking for hours).  

    My first questions is:  

    I am trying to customize the style for the toolbar but only for a specific site.  Where is the style called "ms-menutoolbar" and how can I edit the style so it only affects the toolbar in my top level site collection AND the subsites?

    I do NOT want the style change to affect other site collections.

    My next question is more related to your post but also related to my last question:

    How can I change the toolbar to only apply to the site collection and all subsites but not to all site collections?


  2. sukumar says:

    Thank you very very much this was helpfull

  3. Cinek says:


    There is simplest way to hide these items. Open your page in SP Designer. Right click on web part and select "Convert to XSLT Data View". Next, you can click on toolbar’s items and remove them by pressing DEL.

    BUT! It will be not WebPart any more!



  4. vikram says:

    How can I add new buttons on the toolbar?

  5. saba says:

    can i change the name of items in the toolbar(eg. instead of "Actions"—->"you can" or instead of "new"—>"my text" )

  6. KGR says:

    Thanks, Really Helpful

    Do u have idea how we can add new button on the toolbar? if yes, where will the button action go?

  7. René van der Enden says:

    Thanx for this tip! Unfortunately this works for the complete site. Do you know if it’s possible to combine this with a feature, so I can deal this with only the documentlibraries in one single subsite?

    With kind regards,

    René van der Enden

  8. Mark says:

    Here is code for a Picture Library. I needed to remove the Actions Menu but keep the Settings and Upload.

    <%@ 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="PictureLibraryViewToolBar" runat="server">


                   <wssuc:ToolBar CssClass="ms-menutoolbar" EnableViewState="false" id="toolBarTbl" ButtonSeparator="<img src=’/_layouts/images/blank.gif’ alt=”>" RightButtonSeparator="&nbsp;&nbsp;" runat="server">


                                              <SharePoint:UploadMenu AccessKey="<%$Resources:wss,tb_UploadMenu_AK%>" runat="server"/>

          <SharePoint:SettingsMenu AccessKey="<%$Resources:wss,tb_SettingsMenu_AK%>" runat="server"/>



                                     <SharePoint:PagingButton runat="server"/>

                                     <SharePoint:ListViewSelector runat="server"/>





  9. Pinku says:

    I need to hide the Manage Permission and Manage Copies button form the toolbar of DispForm.aspx in picture library. This should be application only to a particular subsite. Other picture library should not be affected.

    Plz. suggest a way to do so.

  10. Kevin says:

    Has anyone figured out how to do this only to particular sites or subsites?  Doing this across the board on the server isn’t really an option.  Thanks!

  11. shigeki says:

    Hi, i have read this article and want to ask some questions.

    As mentioned in previous comments, button of the toolbar can be hide, but after hide the button, it would not be the webpart.

    I want to know that how can i hide an items of the "Action" Menu.

    For example, i want to hide the "Open with Windows Explorer" of the "Action" Menu.

    How can i do it. I had tried to find the toolbar.ascx template from the path "C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATECONTROLTEMPLATES", but it seems to be useless.

    I also tried to use SP Designer to view the  webpart as XSLT format, i only found this "<SharePoint:ActionsMenu runat="server"/>"

    but how can i access and modify the menuitem from the code.

  12. Bjørn Stærk says:

    Here’s how to do this only for certain sites: Add code to the new ascx that checks the SPContext object, and adds the appropriate version of wsuuc:ToolBar depending on which site you’re on, which template it uses (.WebTemplate + .Configuration), or just about anything else you like.  Then you can have the standard toolbar for ordinary sites, and the custom one for only a few.  

    As for hiding elements, you can create your own class that inherits from ActionsMenu, NewMenu, etc., and remove the items you don’t want.  Then refer to that class in the Template_Buttons section.  In the class, just override AddMenuItems, call base.AddMenuItems() and afterwards loop through MenuTemplateControls.Controls, and remove or change as you like.  Alternatively you can delete the call to base.AddMenuItems, and use AddMenuItem to add the items that you do want.  You can also inherit directly from ToolBarMenuButton, (not much difference).  

  13. shigeki says:

    Thanks for Bjørn Stærk.

    Useful inforamtion.

    But i would like to ask some stupid question.

    How can i inherits that ActionsMenu?

    As i guess, Sharepoint class(.cs/.vb) is generated as .dll format, so we only can inherits it?

    As you said, "Then refer to that class in the Template_Buttons section."

    What is the meaning of "Template_Buttons section". A file name? or… It is because I can’t find this file by the search function.


  14. Magnus says:

    I have been trying to figure out this:

    Why does Read-only-members have access to the option "Open with Windows Explorer" ? Throught the Explorer these members can edit and delete files!

    So I don’t want to hide it, cause it should be available for the site members with full control rights. :

  15. shigeki says:

    Is is because this is the requirement of my cilent.

    He would like to create a group of accouns that has the permission to Read Write Execute of the files.

    The main purpose of hiding the "Open with Windows Explorer" is to ensure users to input some attribute for each file, or to force to run the workflows or events during upload the files by the SharePoint web-based interface.

    To ensure the information consistency, i must hide "Open with Windows Explorer".

  16. aasmag says:

    I am not sure what you meant, but what I want is this:

    Read members should NOT see the "Open in windows explorer" option

    How do you hide it?

    Thanks again

  17. Ibu says:

    Hi Bjørn Stærk,

    Thanks for your help to hide the elements in the New menu.You made my day. When i am creating a custom control for NewMenu how can i add custom action through feature in my custom new menu.I tried with all the possible Location and groupid but the feature did not identify my custom menu. what should be the location for my custom menu instead of Microsft.SharePoint.StandardMenu. Please let me know if you have any input.

  18. David Naas says:

    I’ve tried this code and can’t get it to work there is no chnage to my document libarary what am I not doing



  19. David Naas says:

    I’ve tried the sample code abopve and cannot get it to work.

    I would like to remove the multiple upload options from the Document Library toolbar.  Is there any way to do this.

  20. Bill says:

    Very nice post. It helped me a lot.

    But i need one more thing. Do you know any way to hide dictionary from the toolbar of edit forms?

  21. Putra says:


    I want to know that how can i hide an items of the "Action" Menu.

    For example, i want to hide the "Open with Windows Explorer" of the "Action" Menu.


  22. Darshan says:


    How to hide the same with given sub site.

  23. jatuphum says:


    I want to remove "Actions" and "Uploads" only if user is "Contributor" role.

    Can this solution do?

    Thank you very much.

  24. Rupali Kothawade says:


    Very Nice article. By reading this document I can Hide New button on "Document Library" and "Picture Library".

    Can you please let me know, How do I hide New button on the document library created based on "Custom document library template" ?

    And another thing, How do I deploy this ascx control using Feature?

    Thanks in Advance.

  25. john says:

    I have a similar question as Rupali…how can I do this with other list types?  i.e. Announcements or Custom List.

  26. anne says:

    Hi I want to do this in a listview webpart which is a child control of my WP, is this possible?

  27. aditya says:


    i want to know how can i hide/remove the multiple upload button from the upload menu.

  28. asfar says:

    same problem here, need to remove/hide the single upload button from the upload menu. no luck on any trials.

    anyone can help?

  29. Shanea says:

    Would anyone be willing to post the code to hide the Export to excel option so that I can remove it for the survey function of the site. I am not a programmer so simple instructions such as the ones listed above would do wonders for me.

    Thank you so much!!!


  30. Hiding toolbar menu items in a Sharepoint list

  31. Ketul says:

    Something similar. Removing the Attachment button from the Form Tool bar on NewForm.aspx and EditForm.aspx

  32. First Hand says:

    Новая инфа: Как убрать элементы в стандартном toolbar’е в формах изменения, создания, просмотра элемента…

  33. If you would like to have some paragraphs translated from Polish to English please leave a comment. Post

  34. RachelTerry says:

    But, how are you pointing the lists to now use nonewbuttonfordoclibtemplates.ascx rather than what it wants to use?

  35. george li says:

    I test this code,but it’s not work…

  36. Awanish says:

    How to hide New Menu of Custom List

  37. Arokiasamy says:

    i need to remove upload and settings menu in form library tool bar.

  38. TMac says:

    This really is a great post and it’s about the closest I’ve come to resolving my issue. I need to simply hide the edit button on the menu bar. This is for the calendar and the menu that I’d like to customize is the displayed in the dispForm. This view shows the edit function but again this is where I have a need to remove the ‘edit button’. In doing so I’m hoping to remove users ability to edit items as this should only be an admin function.

  39. Tanmay Bari says:

    Has anyone figured out how to do this only to particular sites/subsites/Document Libraries only?  Doing this across the board on the server isn’t really an option as all the Document Libraries on that particular Site/Subsite takes into effect.Thanks!

  40. Saurabh says:

    Hi can we do this from Schema.xml

  41. SharePoint Customizing SharePoint Context Menus Hidden SharePoint Lists, Fields, and other Advanced List

  42. vamsi says:

    it’s nice article which saves my time. I want hide "view" i mean creat view and modify view options in the list menu bar.How do you do that

  43. Rajdeep says:


    Can anyone give me a javascript which I can use in a content editor webpart to Hide "Edit in Microsoft Office InfoPath" and "Edit Properties" menu items?

    Please dont refer me to some other blog.

    Thanks 🙂

    I already have one function like below:

    function CAMOpt(p,wzText,wzAct,wzISrc,wzIAlt,wzISeq,wzDesc)


    var mo=CMOpt(wzText,wzAct,wzISrc,wzIAlt,wzISeq,wzDesc);


    return null;

    if(wzText != "Edit in Microsoft Office InfoPath" && wzText != "View Properties")

    if(wzText != "Edit Properties")


    return true;


    BUT this is working only when I am in "…..?PageView=Shared" view of the page.

    NOT in AllItems.aspx page.

  44. Open the form allitems.aspx in sp designer , under forms in the library.

    right click ,select  convert to xslt

    when finish the conversion, select the button.

    right clik the button.

    in properties , visble = false.

    voila, it works.

    If you want reverse the process , right click , and select recert to view of sharepoint.

    Gabriel Giraldo

    sharepoint developer.

  45. 8082 says:

    How to Remove or hide toolbars or commandbars ms access 2007

  46. aakash says:


    excellent post,

    i have a requirement to remove NEW button from pages library ONLY. in all other library i NEW button is required.

    please help in this ..

  47. Alexander Sinclair says:

    Is there any possiblity to redirect the ‘new’ button to open my custom page or any other url. we do not want to write any custom event or extend the user control. in short. i want to relieve my administrators from programming.

  48. Keefer says:

    Does anyone know how to remove the New Folder option on the list toolbar in WSS 2.0?

Skip to main content