1

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";
collTopNavigationNode.Add(ciNavigationNode);
clientContext.Load(collTopNavigationNode);
clientContext.ExecuteQuery();

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
1

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):

#heading
$libraries = new-object
Microsoft.SharePoint.Client.NavigationNodeCreationInformation
$libraries.Title = "Libraries"
$librariesNode = $ql.Add($libraries)
$context.ExecuteQuery()

#link inside heading
$library = new-object
Microsoft.SharePoint.Client.NavigationNodeCreationInformation
$library.Title = $title
$library.Url = $url.ServerRelativeUrl
$library.AsLastNode = $true
$librariesNode.Children.Add($library) | Out-Null            
$context.ExecuteQuery()
0

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", ... });
headerNode.Update();

Will let you have the desired result

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.