Is there a possibility to create headings with multiple links in the navigation bar (i.e. top link bar) in SharePoint online using c3 or PowerShell? My initial guess was to use ClientContext to gain access in the following way.

ClientContext clientContext = new ClientContext(siteUrl);
// Get the Quick Launch navigation node collection.
NavigationNodeCollection collQuickLaunchNode = web.Navigation.QuickLaunch;
// Get the top navigatin node collection
NavigationNodeCollection collTopNavigationNode = web.Navigation.TopNavigationBar;

so here I can add a link using

NavigationNodeCreationInformation ciNavigationNode = new NavigationNodeCreationInformation();
ciNavigationNode.Title = "Title";
ciNavigationNode.Link = "www.Link.com";

But what I want is actually a heading that contains links. The links that go in the headings are external links and links of other site collections.

Is there a possibility to to this? If so how?

I have the feature (SharePoint Server Publishing) to modify the navigation turned on and am using an Office 365 tenant with SharePoint Online.

  • 1
    Have you tried not setting the Link property of the NavigationNodeCreationInformation? Set the IsExternal property to true for the links. As to how to get them under the header, I do not know. – wjervis Aug 21 '14 at 16:55
  • Thanks for the reply, I tried not setting a link and it shows the node, but the problem is still how to get links under the header ;) – user3297993 Aug 22 '14 at 6:26

I was just trying to do the same

In SSOM this is possible with

$librariesNode.Properties["BlankUrl"] = "True"

unfortunately, from what I have found it is NOT possible in CSOM

however this guy did it by adding

javascript: return true;

to the url field.

Quick Launch: add new heading without an URL

As for adding a hierarchy, here's the code (using the newly created heading node to add child nodes):

$libraries = new-object
$libraries.Title = "Libraries"
$librariesNode = $ql.Add($libraries)

#link inside heading
$library = new-object
$library.Title = $title
$library.Url = $url.ServerRelativeUrl
$library.AsLastNode = $true
$librariesNode.Children.Add($library) | Out-Null            
| improve this answer | |

Store the NavigationNode object that is returned by

var headerNode = collTopNavigationNode.Add(ciNavigationNode);

method call. On the returned object, add the nodes you want to have as child links via

headerNode.Children.Add(new NavigationNodeCreationInformation { Title = "Child Link", ... });

Will let you have the desired result

| improve this answer | |

CSOM PowerShell code:

To create list heading without URL, try below code. It is tested for SharePoint Online.

$newNavNode = New-Object Microsoft.SharePoint.Client.NavigationNodeCreationInformation;
$newNavNode.Title = "Office 365";
$newNavNode.AsLastNode = $true;
$newNavNode.IsExternal = $true;

$libheading = $dQLaunchColl.Add($newNavNode);

Property "IsExternal = $true" does all magic here. Once it is set to true, ExecuteQuery() will not validate URL.

| improve this answer | |

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.