Implement Custom SuiteLinks Delegate Control in SharePoint 2013

sharepoint 2013 custom SuiteLinks Delegate Control.png
InfoPath alternatives for form designing SharePoint

In this article we will see how to implement SuiteLinks Delegate Control in SharePoint 2013.

SuiteLinksDelegate: is a new delegate control introduced in SharePoint 2013. If you are looking to add a new link just next to “Sites, NewsFeed, SkyDrive” etc. on the top bar of your SharePoint site. You can now do that with a new delegate control “SuiteLinksDelegate”. The SuiteLinksDelegate control will allow us to modify the default links.

Read some SharePoint 2013 tutorials below:

For Example: To add our own links, in the “suit links”
Header before

Implement Custom SuiteLinks Delegate Control in SharePoint 2013
Implement Custom SuiteLinks Delegate Control in SharePoint 2013

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 “MyCustomSuiteLinksDelegate”

custom SuiteLinks Delegate Control sharepoint 2013 visual studio
custom SuiteLinks Delegate Control sharepoint 2013 visual studio

Now Our Solution Explorer looks as follows,

sharepoint 2013 custom SuiteLinks Delegate Control
sharepoint 2013 custom SuiteLinks Delegate Control

Step-4:
Add reference to Microsoft.SharePoint.Portal dll.

sharepoint 2013 custom SuiteLinks Delegate Control
sharepoint 2013 custom SuiteLinks Delegate Control

Step-5:
Code snippet for the ascx.cs file

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebControls;
using System.Globalization;
using System.IO;
using System.Collections;
using Microsoft.SharePoint.Portal;
using Microsoft.SharePoint.Portal.WebControls;

namespace SuiteBarBrandingDelegate_Example.ControlTemplates.SuiteLinksDelegate_Example
{
public partial class MyCustomSuiteLinksDelegate : UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}

protected override void Render(HtmlTextWriter writer)
{
writer.RenderBeginTag(HtmlTextWriterTag.Style);
writer.Write(“.ms-core-suiteLinkList {display: inline-block;}”);
writer.RenderEndTag();
writer.AddAttribute(HtmlTextWriterAttribute.Class, “ms-core-suiteLinkList”);
writer.RenderBeginTag(HtmlTextWriterTag.Ul);
RenderSuiteLink(writer, “http://AboutUs/”, “About Us”, “lnkSearchLink”, false);
RenderSuiteLink(writer, “http://ContactUs/”, “Contact Us”, “lnkSearchLink”, false);
RenderSuiteLink(writer, “http://Feedback”, “Requisition Manager”, “lnkSearchLink”, false);
writer.RenderEndTag();
base.Render(writer);
}
}
}

Step-6:
Add Elements.xml file to the Solution, Provide the name and click on Add.

sharepoint 2013 custom SuiteLinks Delegate Control
sharepoint 2013 custom SuiteLinks Delegate Control

Step-7:
Click on elements.xml file paste the below code snippet inside the elements tag

<?xml version=”1.0″ encoding=”utf-8″?>
<Elements xmlns=”http://schemas.microsoft.com/sharepoint/”>
<!– Adding DelegateControl reference to our custom SuiteSuiteLinksDelegate Control –>
<Control ControlSrc=”/_controltemplates/15/SuiteLinksDelegate_Example\MyCustomSuiteSuiteLinksDelegate.ascx”
Id=”SuiteLinksDelegate” Sequence=”90″ />
</Elements>

Step-8:
Final step is build and deploy then the SharePoint text will be over ride with the Text of the portal.

The final Outcome will be look as follows:

sharepoint 2013 custom SuiteLinks Delegate Control
sharepoint 2013 custom SuiteLinks Delegate Control

Similar SharePoint 2013 Tutorials


About Sagar Pardeshi

I am Developer working on Microsoft Technologies for the past 6+years. I am very much passionate about programming and my core skills are SharePoint, ASP.NET & C#,Jquery,Javascript,REST. I am running this blog to share my experience & learning with the community I am an MCP, MCTS .NET & Sharepoint 2010, MCPD Sharepoint 2010, and MCSD HTML 5,Sharepoint 2013 Core Solutions. I am currently working on Sharepoint 2010, MOSS 2007, Sharepoint 2013,Sharepoint 2013 App Dev, C#, ASP.NET, and SQL Server 2008.

View all posts by Sagar Pardeshi →

Leave a Reply