Adding New Link to PromotedActions Delegate Control in SharePoint 2013

Leave a Comment
Hi All,

As we have already known, In SharePoint 2013 there were 3 new Delegate Controls had introduced.
They are  ,
  • PromotedActions
  • SuiteBarBrandingDelegate Conrtol
  • SuiteLinks


In Our current post we will see how to add new link to a PromotedActions Delegate Control.

PromotedActions Delegate Control will look as follows in SharePoint Page.


Step 1:

Create One Empty SharePoint Project and Provide the Solution Name and Choose the Solution Path and Click on 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 “MyCustomPromotedAction”


Now Our Solution Explorer looks as follows,



Step 4:

Now Open the “.ascx” of the User Control and paste the below code.

<a title="Post On Twitter" class="ms-promotedActionButton" style="display: inline-block;" href="http://www.twitter.com">
    <span class="s4-clust ms-promotedActionButton-icon" style="width: 16px; height: 16px; overflow: hidden; display: inline-block; position: relative;">
        <img style="top: 0px; position: absolute;" alt="Share" src="/_layouts/15/images/Practice/twitter.jpg"/>
    </span>
    <span class="ms-promotedActionButton-text">Post on Twitter</span>
</a>



Step 5:


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


Step 6:

Open the Elements.xml file and change the ContolSrc Path and map it to our new user control(MyCustomPromotedAction.ascx)

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <!-- Adding DelegateControl reference to our custom PromotedActions Delegate Control -->
  <Control ControlSrc="/_controltemplates/15/PromotedActions_Sample/MyCustomPromotedAction.ascx"
           Id="PromotedActions"
           Sequence="1" />
</Elements>



Step 7:

Now Deploy the Solution and Navigate to your site and check .
The final Out come will be look as follows





You Can download the solution file from the below link.

Download Link:

https://sites.google.com/site/sharepointkitchenblog/PromotedActions_Sample.7z

Thanks.

Related Post

0 comments:

Post a Comment