I want to hide a SharePoint 2010 ribbon button for a list based on SharePoint groups.

    using (SPSite site = new SPSite(SPContext.Current.Web.Url))
    using (SPWeb web = site.OpenWeb())
        SPList list = web.Lists.TryGetList("BMS");

        if (list != null)

            SPRibbon ribbon = SPRibbon.GetCurrent(this.Page);
            string user = HttpContext.Current.User.Identity.Name;
            SPWebLocation = web;
            if (ribbon != null)
                string Editorsgroup = "Editors";

                if (isUserInGroup(Editorsgroup, user))

but it's hiding the ribbon for all pages and all lists.

I need to hide the ribbon button for only one list.

Is there any alternate way to dynamically hide the ribbon button for a list?

I need to hide the ribbon button programmatically.

2 Answers 2


This product actually allows you to hide or disable buttons (based on SharePoint permissions) on the Ribbon panel: http://www.xstreamsoftware.com/Sharepointribbonizer.htm

  • i tried the product but after i apply the conditions for ribbon, the total ribbon bar is not working like some times the ribbon bar is not showing, some time the ribbon buttons are not working. Mar 21, 2013 at 9:17
  • Which browser were you using and what version?
    – Will Au
    Mar 21, 2013 at 17:35
  • i tested on IE8 an firefox 18 and chrome, i all 3 browsers it giving same problem. if i remove xtream ribbonizer settings or rules, the ribbon bar working normally. Mar 21, 2013 at 21:00
  • I just tried the product with the following browsers on my VM: IE8, Firefox 19, and Chrome. It works on all of them. Can you tell me which exact settings you applied that caused your issues? I can try to replicate on my side here...
    – Will Au
    Mar 22, 2013 at 20:14
  • the product is working may be my virtual machine has problem. Mar 22, 2013 at 22:01

What you are checking is only if the specified list exists on the web, not that you are actually on a page with a view of that list.

Maybe javascript is the way to go for this case? Hiding the button only on your pages that contains a listview for your list?

On this page you will find an example of using Javascript. The key is to identify the correct item to hide from the DOM. Usally you can use the id of the link as in the example above.

Then you will need to add this script to your pages as Mike shows you in this article

  • can you give me some example links to hide SharePoint list item with java script programmatically. i tried googling but it shows this way only. i need to hide particular list ribbon button. Feb 26, 2013 at 10:51
  • Please see my updated answer above Feb 26, 2013 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.