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.
Challenge:
How do I add or remove a custom button on the new SharePoint 2010 Ribbon?
Solution:
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):
The schema here is basically: Ribbon.[Tab].[Group].Controls._children
And here is the resulting Ribbon group displayed in the UI:
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:
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:
When this code runs, the custom button will be removed from your Ribbon.
See Also:
Notes:
See the attachment for the source code and script of this example.
SharePoint Online
The cloud parts are functional components that extend your SharePoint Online environment in Microsoft 365.
Supports Classic and Modern sites for SharePoint Online/Microsoft 365
Small Business Pricing and Discounts
SharePoint
Top SharePoint Online Products
Experience greater power and savings by bundling our SharePoint apps and cloud parts.
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 2016, 2019, 2022 – Classic Pages Only
SharePoint
Top On-Premises Only Products
Experience greater power and savings by bundling our SharePoint apps and web parts.
Our team of Microsoft 365 Technology Consultants helps you get the most out of your Microsoft technology, we have the best Microsoft 365 talent to streamline your organization.
Consulting to Streamline Your Department
M365 Plus
Managed Services
Microsoft 365
Consulting to Streamline Your Department
Our Consultants Have What You Need
Federal Contractors
Microsoft 365
Our Consultants Have What You Need