Hide Button in Ribbon SharePoint 2010

Simple question, how do you hide or remove a button from the ribbon in SharePoint?

In my case, I needed to remove the Upload Document and Open with Explorer buttons for my Form Library.

Open your site using SharePoint Designer.  Once opened, navigate to your Library and edit your default view.  (All Files -> Your Library -> Forms -> Your View.aspx, right click and select Edit File in Advanced Mode)

At the bottom of the screen, you will see three options Design, Split, and Code.  Select the Split option.

In your code window, locate the <asp:Content ContentPlaceHolderId=”PlaceHolderMain” runat=”server”>  tag.

Now, enter the code below in a line after the PlaceHolderMain tag.

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function () 
{
    setTimeout(HideRibbonButton, 10);  
});
 
function HideRibbonButton()
{
    $('a[id*="OpenWithExplorer"]').hide();   
    $('a[id*="AddDocument"]').hide();     
    setTimeout(HideRibbonButton, 10);
}    
</script>

Click save, then refresh your page.  The Documents tab should now be missing the Upload Document button and the Library tab should be missing the Open with Explorer button.

How I’m finding the items that I want to hide.
using this link:
http://msdn.microsoft.com/en-us/library/ee537543(v=office.14).aspx
Find the item you want to hide (open with explorer).
Ribbon.Library.Actions.OpenWithExplorer

Then use the last part of the string OpenWithExplorer in your jquery.

*NOTE*

The Library I’m working with is locked down and users are not able to create their own Views. If someone creates a new View, the buttons will be available on that page.

9 thoughts on “Hide Button in Ribbon SharePoint 2010

  1. Nice post but in my case, I can’t insert the css code above the tag , I put the code after in style tag.

    .ms-bodyareaframe {

    padding: 0px;
    }

    #Ribbon\.Documents\.New\.AddDocument-Large{
    display:none;
    }
    #Ribbon\.Library\.Actions\.OpenWithExplorer-Medium{
    display:none;
    }

    Thank you very much…

  2. I cannot get this to work for the Approve/Reject button. I have tried ti using the ribbon Id which is ApproveReject, and the webpart ID which is Approve.Reject. It does not work either way.

  3. Try:

    $(‘a[id*=”Ribbon.Documents.Workflow.Moderate-Medium”]’).hide();
    $(‘a[id*=”Ribbon.Documents.Workflow.Moderate-Small”]’).hide();

  4. I’m trying hide the button new folder with

    $(‘a[id*=”Ribbon\.Documents\.New\.NewFolder-Large”]’).hide();

    It’s didn’t work, can you help me.

  5. Great! This helped a lot.

    BTW: Fran, the keyword to use for hiding the Approve/Reject is: Moderate

    $(‘a[id*=”Moderate”]’).hide();

    it worked fine for me!

  6. Thank you so much. This worked a treat and your answer seemed the only sensible solution I could find after a 2 hour search on the web. Keep up the good work and thank you for sharing your solution.

  7. This worked for me hiding the approve/reject button using the below:

    $(“a[id*=’Ribbon.ListForm.Display.Manage.ApproveReject’]”).parents(“span.ms-cui-row”).hide();

    Thanks for the help.

Leave a Reply

Your email address will not be published.