In SharePoint 2010, if you add a new SPNavigationNode as a child to a Heading link, then the type of the new link will automatically be Link:
If you however add it as a root level node, then the type will be Heading:
Use the following code to add a root level node as type Link:
using (var site = new SPSite("http://myServer")) { using (var web = site.OpenWeb()) { var newNode = new SPNavigationNode("Root Level Link", "http://www.ms.com", true); newNode = web.Navigation.QuickLaunch.AddAsFirst(newNode); newNode.Properties.Add("NodeType", "AuthoredLinkPlain"); newNode.Update(); } }
newNode.Properties.Add(“NodeType”, “AuthoredLinkPlain”) is the magic line that makes it works.