Add,Remove Links in Top Suitebar (SkyDrive,Sites,NewsFeed) in SharePoint 2013

Summary : Add,Remove SkyDrive,Sites,NewsFeed in Top Suitebar in SharePoint 2013,SharePoint 2013 Disable skydrive,SharePoint 2013 remove skydrive,Override “SuiteLinksDelegate” Delegate Control, SharePoint 2013 hide skydrive link,Customize DeltaSuiteLinks Delegate Control,Customize Top Suitebar SkyDrive, Sites, NewsFeed in SharePoint 2013

As a part of a new UI in SharePoint 2013, Microsoft has added a new Links Bar also known as “Suite bar” that displays Links NewsFeed, SkyDrive and Sites. These links are displayed using “SuiteLinksDelegate” Delegate Control which has also been Introduced inSharePoint 2013. Adding, Removing and Customizing these Links however is not easy. You can only add and remove these links by Overriding “SuiteLinksDelegate” Delegate Control with a feature solution created in Visual studio. There is no Out-of-Box way to do this however you can choose to hide the entire Control using CSS and other tricks see the post SharePoint 2013 – Hide NewsFeed, SkyDrive, Sites (DeltaSuiteLinks)

Because We’re So Good, Our Content gets Copied very Often.If you are not reading this on LearningSharePoint.com, please read the Original article Here for details, comments and updates on this post.


In this post we will see a Step-by-Step tutorial on How to Create a Solution for Overriding SuiteLinksDelegate Delegate Control and add Custom links in the suite bar.This is what it will look like

Custom links in Suite Bar

Because We’re So Good, Our Content gets Copied very Often.If you are not reading this on LearningSharePoint.com, please read the Original article Here for details, comments and updates on this post.



To Create this solution we will do the following –

1. Create an Empty Solution.
2. Add a new UserControl with the new links and add its entry to Elements file.
3. Add a SafeControl entry (using manifest file)
4. Deploy and Test.

Lets look at the Steps –

1. Create an Empty Solution in Visual Studio 2012.

2. Deploy it as Farm.
deployasfarm

3. Add a new Item and add a new User Control.

Add a new add a new User Control (Farm solution)

When you add a user Control, a new Control ‘suitelinksdelegatectrl’ under “ControlTemplates” gets created.This ControlTemplates is mapped to _ControlTemplates folder in 15 hive. To view the Code file for this control right click on the Delegate Control and click View Code.

4. Add the following code in ‘SuiteLinksDelegateCtrl.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 CustomSuiteLinksDelegate.ControlTemplates.CustomSuiteLinksDelegate
{
public partial class SuiteLinksDelegateCtrl : 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);
AddSuiteLink(writer, “http://learningsharepoint.com”, “Learning SharePoint”, “Lsp”);
writer.RenderEndTag();
base.Render(writer);
}

protected static void AddSuiteLink(HtmlTextWriter writer, string url, string name, string linkId)
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, “ms-core-suiteLink”);
writer.RenderBeginTag(HtmlTextWriterTag.Li);
writer.AddAttribute(HtmlTextWriterAttribute.Class, “ms-core-suiteLink-a”);
writer.AddAttribute(HtmlTextWriterAttribute.Href, url);
writer.AddAttribute(HtmlTextWriterAttribute.Id, linkId);
writer.RenderBeginTag(HtmlTextWriterTag.A);
writer.AddAttribute(HtmlTextWriterAttribute.Class, “ms-verticalAlignMiddle”);
writer.RenderBeginTag(HtmlTextWriterTag.Span);
writer.Write(name);
writer.RenderEndTag();
writer.RenderEndTag();
writer.RenderEndTag();
}
}
}

AddSuiteLink() is a function to add new links to the UL list rendered inside the Control.

5. Next add an empty Elements file to add the Control entry.
AddSuiteLink elements

Add the following in the Elements file.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Control Id="SuiteLinksDelegate"
Sequence="90"
ControlSrc="/_ControlTemplates/15/CustomSuiteLinksDelegate/SuiteLinksDelegateCtrl.ascx">
</Control>
</Elements>

6. Next Build and Deploy.

Resulting Suite Bar –
Custom links in Suite Bar

Related Post :

Options to Hide NewsFeed, SkyDrive, Sites (DeltaSuiteLinks) in SharePoint 2013

Hide links(NewsFeed, SkyDrive, Sites..) using JavaScript Name, ID

Add Links to Promoted Actions (Share,Follow,SYNC) in SharePoint 2013

Original article : Here


Comments

  1. Jason Williams says:

    We want to do this exact thing for our 2013 deployment, but I’m stuck on step 1. How Do I get SharePoint 2013 templates installed in VS2012? I see SP2010 stuff, but not 2013.

  2. @Jason Williams, did you get a reply regarding this – I need SharePoint 2013 too.

  3. Mr Andersson says:

    Use VS 2012 and Install RTM Office Developer tools.
    http://www.microsoft.com/visualstudio/eng/office-dev-tools-for-visual-studio

  4. I managed to get visual studio with 2013 templates here
    http://msdn.microsoft.com/en-US/office/apps/fp123627
    goto Tools and download tools
    http://aka.ms/OfficeDevToolsForVS2012

    How ever It did not work. I added solution using powershell and intalled it, the solution appeared in the sharepoint admin as globaly deployed but no change to the links in the suitebar

  5. extra info
    In the Solution Explorer, highlight the Empty Element . In the Properties window, select the […] button for the Safe Controls property to open the Safe Control Entries window.
    Add a new Safe Control entry for the custom user control
    Name: SharePointDelegatesControlTemplates
    Assembly: $SharePoint.Project.AssemblyFullName$
    Namespace: SharePointDelegates.CONTROLTEMPLATES.SharePointDelegates
    Safe: True
    Safe Against Script: True
    Type Name: *
    also I had to add references so that
    using Microsoft.SharePoint.Portal
    using Microsoft.SharePoint.Portal.WebControls
    worked
    once the solution was deployed it appears as a solution in central administration once deployed from there it appears as a feature. almost works but tall the links disappear instead of a new one added

  6. Unfortunatly this proposed solution to adding links to suiteLinkBar on the right is not working the solution appears in central admin solutions when deployed the feature appears when active all links newsfeed skydrive sites disappear no new links any idea whats going wrong.

  7. JMay,
    Even I did the same thing here, It got worked in my Development sites. Where as in prod, I dont see anything. Feature appears under the Site features, when I activate it all links newsfeed, skydrive and sites will disappear. No new links.
    Any idea here folks??

  8. I get the same result. It is working good in my development sites, not in the production. I followed the same steps mentioned in this article.
    Links will disappear, when I activate the feature.
    It is a bit urgent, please suggest me here.

  9. Thank You!!!

Speak Your Mind

*