Tag Archives: SharePoint 2013

Add custom link to structural navigation menu

Recently I had to add custom link to structural navigation menu in SharePoint 2013. After searching on over the net I found noting and tried to check what properties should be set inside navigation provider by craeting manually link in SharePoint navigation and checking result with debugger…

Here are properties that should be set to be able to insert custom link node in global navigation provider:

ndParent.Properties["NodeType"] = "AuthoredLinkPlain";
ndParent.Properties["vti_navsequencechild"] = true;

  • NodeType property indicates that the node is a custom link.
  • vti_navsequencechild property makes link to appear inside the navigation provider

Here is a full peace of code to add link:

private void SaveNavigationNode(string title, string url)
if (string.IsNullOrEmpty(title)) return;
if (string.IsNullOrEmpty(url)) return;

var web = SPContext.Current.Web;

web.AllowUnsafeUpdates = true;

// Get the top link bar.
var topnav = web.Navigation.TopNavigationBar;

var existingNode = topnav.Cast().FirstOrDefault(n => n.Title.ToLowerInvariant().Equals(title.ToLowerInvariant()) ||

if (existingNode == null)
var ndParent = topnav.AddAsFirst(new SPNavigationNode(title, url, true)); // Add to collection.
ndParent.Properties["NodeType"] = "AuthoredLinkPlain";
ndParent.Properties["vti_navsequencechild"] = true;
existingNode.Title = title;
existingNode.Url = url;

web.AllowUnsafeUpdates = false;

Hope this helps,

Andrew Adamich


Reset pages to default state as site definition (reghost) using default SharePoint page

Recently had to reghost all pages to its initial state as it is declared in site definition.

Previously in SharePoint 2010 PowerShell had to be used to do that job. In SharePoint 2013 new page wes added to reghost all pages to its initial state. To do that go to:


this will reghost all pages on you site or one single page. Just change URL to your site URL.

Hope this helps,

Andrew Adamich

Custom icons for list definition using XML

Recently I had to specify custom icons for the list definition I have created using XML definition in visual studio. Solution is quite easy to implement – just specify your icon path in the XML property of list definition

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

When insert image in a such way you should know that this image will be used on:

  • Site contents page. The size of the icon should be 96×96 px.
  • Content and structure where size of the icon should be 16×16 px.

However, when icon specified in list definition is large one it is also shown as large one in “Content and structure” where it should be 16×16 px.


To solve this you should prepare three sets of images. SharePoint manages itself which image to display. However you should have right naming convention to make it work.

  • Small image (16×16 px) – name should starting with ITImageName
  • Medium image (32×32 px) – name should starting with MGSameImageName
  • Large image (96×96 px) – name should starting with LTSameImageName


  • Name of the icon you try to show should be the same for all three images and only prefix should change.
  • These icons should be deployed in /_layouts/15/images folder (/_layouts/14/images for SP2010). You can have another level Inside this folder to isolate your project’s icons.
  • Name of your icon SHOULD NOT start with on of the following letters: L, M, I because these ones are used for prefix.
  • Icon path specified in the list definition XML file should be small icon path. SharePoint will automatically pick up right size icon when displayed on page.

Here is how it should look like:

Custom icons for list definition

Content and structure

Andrew Adamich