2

I need to create a custom link which open a custom application page. Here is a screenshot of what I exactly mean:

enter image description here

How can I create such a link on this bar which only opens a .aspx page?

Update I need to do this

  1. Without modifying the masterpage
  2. packagable through module etc.
2

Modify your master page and add the link with desired name and url. It will fulfill your purpose.

Please have a look at this article for a start.

If you don't want to modify existing master page, you can do it through code by changing the SuiteLinksDelegate Delegate Control, please have a look here for more information.

public partial class SuiteLinksDelegate : MySuiteLinksUserControl {
    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);

        // The true/false parameter means if it should be the active link or not - since I'm shooting off this to an external URL, it will never be active..
        RenderSuiteLink(writer, "http://timelog.tozit.com", "Time Report", "ReportYourTimeAwesomeness", false);

        writer.RenderEndTag();
        base.Render(writer);
    } }
  • 2
    I need to do it through a solution without modifying the masterpage. – BOG Nov 18 '15 at 12:28
1

If you don't to update master page, you can achieve it using JavaScript. You need to know rendered html of the SuiteBar links, which is something like below.

enter image description here

So to add one more link below code can be helpful.

var customLi = "<li class='ms-core-suiteLink'><a class='ms-core-suiteLink-a' target='_blank' href='www.yourlink.com'>Your Custom Link</a></li>";
if(jQuery("div#suiteLinksBox").children("ul").length > 0){
        jQuery("div#suiteLinksBox").children("ul").append(customLi);

}
else {
        jQuery("div#suiteLinksBox").html('<ul class="ms-core-suiteLinkList">' + customLi + '</ul>')
}

The result of above code will be

enter image description here

Refer this in detail at Customize SharePoint 2013 suite bar

  • I think it will be nearly the same for the Links in the bar below. – BOG Nov 18 '15 at 12:39
  • But one more: Isnt it possible to have such a link through a module, or anyting else which i could create for example like a custom action and put it in my feature? – BOG Nov 18 '15 at 12:40
  • How do you plan to deploy? JavaScript files can be placed in modules, which when deployed dumps files into Style Library. – Asad Refai Nov 18 '15 at 12:47
  • I have a large solution (Visual Studio SP Solution with WSP output). This needs to deployed by the infrastructure team and a feature should be activated on a dedicated sitecollection to active this link for this sitecollection. – BOG Nov 18 '15 at 12:49
  • Does your solution contains modules of something like Scripts, there you can place this file. And Elements.xml of module mention where you to get this file deployed. You will not required to update the master page, but at least needs to add a line which registers this script. – Asad Refai Nov 18 '15 at 12:52
1

As found on Tobias Zimmergren's Blog you need to do the following:

Create an Elements.xml

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

  <!-- DelegateControl reference to the PromotedActions Delegate Control -->
  <Control ControlSrc="/_controltemplates/15/Zimmergren.DelegateControls/PromotedAction.ascx"
           Id="PromotedActions"
           Sequence="1" />

</Elements>

Create an User Control PromotedActions.aspx

<!-- Note: I've removed the actual Facebook-logic from this snippet for easier overview of the structure. -->
<a title="Share on Facebook" class="ms-promotedActionButton" style="display: inline-block;" href="#">
    <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/Zimmergren.DelegateControls/facebookshare.png"/>
    </span>
    <span class="ms-promotedActionButton-text">Post on Facebook</span>
</a>

Thats it!

0

May be help for you:

The Green(Blue) one is called "Suite Bar", while the grey one (with Share, Follow buttons) are called "Promoted Actions"..

Using delegate you can have your custom Suite Bar or Promoted Actions.. Following tutorials should help:

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

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

Arsalan Adam Khatri

  • The links no longer work as of 04/15/2019 – Omegacron Apr 15 at 22:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.