SharePoint 2010 Cookbook: How to Add or Remove a Custom Button on the Ribbon

SharePoint 2010 contains numerous improvements in the user interface and has been built so that it can be extended even further.  By now, I’d guess that most of you have seen the Ribbon in SharePoint 2010, and many of you have probably even tried actions such as adding a button to the Ribbon.  As you’ve probably learned, adding a button is quite an easy and intuitive task, but trust me: performing some of the more advanced contextual and dynamic customizations to the Ribbon can really make you sweat!

The Ribbon is a great new feature which was introduced in SharePoint 2010.  In this article, we will take a look at how to add or remove custom buttons on the Ribbon in SharePoint 2010.


How do I add or remove a custom button on the new SharePoint 2010 Ribbon?


Create a Custom Button on the SharePoint 2010 Ribbon

Create Feature Elements File

OK, let’s take a loot at  the code which follows.  What we have here is my Element.xml feature.  Please pay special attention to the ID Group of my extension (red rectangle):

Add or Remove the Ribbon in SharePoint 2010


The schema here is basically: Ribbon.[Tab].[Group].Controls._children

And here is the resulting Ribbon group displayed in the UI:

Add or Remove the Ribbon in SharePoint 2010


Remove a Custom Button from the SharePoint 2010 Ribbon

At times, you may need to remove some buttons, tabs, or groups from the Ribbon, or otherwise customize the Ribbon to suit  your needs.  Below, what we want to do is remove the custom button from the Ribbon.  This is easily accomplished  adding the following code to Page_Load:

Add or Remove the Ribbon in SharePoint 2010

Note: You will get some squiggly lines underneath SPRibbon. Don’t worry about that, but you will need to add the “using” statement shown below:

Add or Remove the Ribbon in SharePoint 2010

When this code runs, the custom button will be removed from your Ribbon.


See Also:


See the attachment for the source code and script of this example.

All SharePoint Versions

The web parts are functional components that extend your SharePoint environment whether it’s hosted, on-premises, or part of Microsoft® Office 365.

SharePoint 2013, 2016, 2019, Online (Office 365)

On-Premises Only

These web parts extend SharePoint beyond its out-of-the-box capabilities by tailoring it to your requirements with Bamboo Solution’s growing portfolio of SharePoint Web Parts.

SharePoint 2013, 2016, 2019


Product Suites

Experience greater power and savings by bundling our SharePoint apps and web parts.

Essentials Suite

Essentials Plus Suite

Bamboo Premier Suite

Project Management Suite

Knowledge Management Suite

External User Manager


For more information on our product suites, contact us.

Featured Services

SharePoint Health Check

A SharePoint Health Check will identify the causes of issues and risks associated with your specific environment, and is custom tailored to provide you with the best recommendations to optimize your SharePoint environment.

SQL Health Check

Document recommendations relating to performance, stability, availability, or a specific focus you request of your SQL Server database instances.

My SharePointXperts

The truth is that each SharePoint skill may not be a full time job for many organizations, and it is nearly impossible for one person to do everything you need – so augment your team with SharePointXperts; providing the skill sets you need when you need them!