Tag Archives: SharePoint 2010

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


SharePoint 2010 database size

Recently had issue with database size increasing very fast. To find out what takes so much place inside SharePoint database do following actions:

  • Inside SQL Server Management Studio find content database
  • Right click on databse -> Reports -> Standard Reports -> Disk Usage by Top Tables

This will report you in desc order which tables takes much space.

In my case I had table AllUserData that took me 4,5GB of data. In this table all list items are stored. To find out by list you should query database.

Note, this is forbinden to edit fields inside SharePoint databse. This is on your own risk.

In our case we will just query without editing fields.

Take all lists using following query:

FROM [WSS_Content_DB].[dbo].[AllLists]
order by [tp_LastSecurityChange] desc

This will return you all list ordered by change last date.

To get number of items for this list use following query (this can be slow depeding on your list size):

FROM [WSS_Content_DB].[dbo].[AllUserData]
where [tp_ListId] > ‘A6C61333-BC89-49B9-A8FA-D5210FDE9FAD’

Where  [tp_ListId] is a [tp_ID] field value of [AllLists] table.

You can do revert operation by getting list ID in items table and find what the list is.

Andrew Adamich