1

How can I replicate the "Add heading" functionality of the left quick launch bar with the client side object model?

The task looks simple. Update the left bar of several sites by with a few links grouped by header like:

Link group 1
    Link 1
    Link 2
Link group 2
    Link 3

I can create the nodes and arrange them, but the "Link group x" nodes also turn into hyperlinks, even if I don't set the URL property of the NavigationNodeCreationInformation object in Sharepoint 2010, VB.

How can I either create a blank group without link?

The related part of the code (removed the actual links)

nciHead.Title = "Group 1"
nciHome.Title = "Homepage"
nciHead.IsExternal = True 'otherwise it fails
nciHome.Url = "link1"
nd = qlColl.Add(nciHead)
nd.Children.Add(nciHome)
nd.Update()
context.ExecuteQuery()

1 Answer 1

2

funny you are asking, 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.

https://social.technet.microsoft.com/Forums/en-US/43fcf510-03e6-409c-85ac-84347eccb865/quick-launch-add-new-heading-without-an-url?forum=sharepointgeneralprevious

more here

SharePoint 2013: Client Object Model NavigationNode properties

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.