hide or disable buttons in the ribbon

How do you hide a button for a specific library?  

I'm trying to hide the Upload Document button.  Users still need to be able to create new documents, just not upload them.

The solutions I've found are saying to create a Site Feature.  But wouldn't that disable the button on all libraries in that site?

July 26th, 2012 4:24pm

This blog has some good examples using javascript to hide. Remember in SP2010 save the javascript in a separate library and then refer to it from CEWP.

http://techtrainingnotes.blogspot.com/2008/02/sharepoint-hiding-menus-not-using.html

  • Proposed as answer by CapnGrizzle Thursday, July 26, 2012 2:20 PM
  • Unproposed as answer by eHaze Friday, July 27, 2012 4:48 PM
Free Windows Admin Tool Kit Click here and download it now
July 26th, 2012 4:48pm

For testing, I created a new View (test.aspx).

Opened the View in SPD.

Before the closing tag of <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server"> 

I added the below script.  Clicked save, then opened the View. The Open with Explorer button is still in the ribbon.

<script Type="JavaScript">
 var doc = document.getElementsByTagName('ie:menuitem'); 
 for (var i = 0; i < doc.length; i++)
  {
    itm = doc[i];
    if (itm.id.match('OpenInExplorer')!=null)
      { itm.hidden=true; }
  } 
</script> 

Any ideas?

July 26th, 2012 11:06pm

it is possible to hide Ribbon-items in CSS:

<style type="text/css">
#Ribbon\.ListItem\.Actions
{
display: none !important;
}
</style>

Free Windows Admin Tool Kit Click here and download it now
July 27th, 2012 12:47am

Thank you Sjoerd!

For anyone else looking for the solution to this question.

inside the </asp:Content> tag of <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server"> place the following css:

<style type="text/css">
#Ribbon\.Documents\.New\.AddDocument-Large
{
    display:none;

</style>

Using IE, you can find the different buttons by clicking on F12 (developer tools).  

Please take note of the \ before each period in the above example.  My example hides the Upload Document button from the ribbon.

July 27th, 2012 5:29pm

Looks like a better solution
Free Windows Admin Tool Kit Click here and download it now
January 31st, 2015 5:15am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics