Share via


SharePoint 2013: Implement Custom Promoted ActionsDelegate Control

Introduction

In this article, we will see how to implement PromotedActionsDelegate Control.

PromotedActions:

Delegate Control is responsible for displaying Links “Share, Follow, SYNC, EDIT” in the top right below SuiteLinksDelegate Control. These links can be replaced by Overriding PromotedActions Delegate Control using a Custom Control created using Visual Studio to the following area on a SharePoint site in the top-right section of the page.

http://csharpcorner.mindcrackerinc.netdna-cdn.com/UploadFile/sagarp/implement-custom-promoted-actionsdelegate-control-in-sharepo/Images/newsfeed.jpg

Step 1:
**
**Create one Empty SharePoint Project and provide the Solution Name and choose the Solution Path and click OK.

Step 2:
**
**Deploy the Solution as Farm Solution. Provide the Url in next screen and validate the Connection.

Step 3:
**
**Add New UserControl to the Project from the Templates and provide the Name to it, in our case it is “MyCustomPromotedActionsDelegate”.

http://csharpcorner.mindcrackerinc.netdna-cdn.com/UploadFile/sagarp/implement-custom-promoted-actionsdelegate-control-in-sharepo/Images/MyCustomPromotedActionsDelegate.jpg

Now our Solution Explorer looks like the following,

http://csharpcorner.mindcrackerinc.netdna-cdn.com/UploadFile/sagarp/implement-custom-promoted-actionsdelegate-control-in-sharepo/Images/Solution.jpg

Step 4:

Now open the “.ascx” of the User Control and paste the following code.

http://csharpcorner.mindcrackerinc.netdna-cdn.com/UploadFile/sagarp/implement-custom-promoted-actionsdelegate-control-in-sharepo/Images/ascx.jpg

Step 5:

Add Elements.xml file to the Solution, provide the name and click Add.

http://csharpcorner.mindcrackerinc.netdna-cdn.com/UploadFile/sagarp/implement-custom-promoted-actionsdelegate-control-in-sharepo/Images/Elements.jpg

Step 6:

Click on elements.xml file and paste the following code snippet inside the elements tag,

  1. <?xmlversion="1.0"encoding="utf-8"?>  
  2.     <Elementsxmlns="http://schemas.microsoft.com/sharepoint/">  
  3.   
  4.         <!-- DelegateControl reference to the PromotedActions Delegate Control -->  
  5.         <ControlControlSrc="/_controltemplates/15/PromotedActionsDelegate_Example/MyCustomPromotedActionsDelegate.ascx" Id="PromotedActions" Sequence="1" />  
  6.   
  7.         </Elements>  
  8.   </Elements>  

Step 7:

Final step is to build, deploy and then ad additional link.

The final outcome will look as follows:

http://csharpcorner.mindcrackerinc.netdna-cdn.com/UploadFile/sagarp/implement-custom-promoted-actionsdelegate-control-in-sharepo/Images/Outcome.jpg