Exercise 2 - Customizing the Ribbon
Task 1 – Add an empty elements.xml file to the project
In this task, you will add a new button to the items section of a custom Products list. The button will go in the red area in the image below. The button will be a shortcut to the list settings page for the list.
In order to do this, you will add a new empty Elements file to your project which will become the basis for the ribbon customization. You will then add the required CAML that will insert the button and define the action that should happen when a user clicks the button.
Note the following important sections of the code
Note the following important section of code:
Location="Ribbon.ListItem.New.Controls._children – This line specifies where the button will be located within the ribbon. See MSDN documentation for additional details about this section.
ListItem indicates that we want the button to be located in the List Tools section group.
New indicates that we want the button to be in the New section of the ribbon.
Controls._Children indicates that this will be a new control, not a replacement for an existing control.
Task 3 – Test the Solution on premise
In this task, you will deploy your solution to your local SharePoint instance and verify that the ribbon button has been created and that a new List Settings button is visible.
Press F5 to run the solution against your local SharePoint 2010 instance.
Task 4 – Deploy the Solution to SharePoint Online
In this task, you will deploy the solution package to SharePoint Online to confirm that it works as expected.