Question

How can I add a link on the quick launch of a subsite, which bring us on the level 2 subsite ?

if I do

$spweb = Get-SPWeb http://url:portwebapp/SiteCollection/SUBSITE1/SUBSITE2

Then

$spweb.AddToQuickLaunch

It doesn't work =/

I want to have links for all my SUBSITE2, on the quick launch of the SUBSITE1

Thanks,

Nico.

Was it helpful?

Solution

AddToQuickLaunch can only be used when you create a New-SPWeb. To change current navigation, you need to tell SharePoint where to place your links. Like the following:

$web = Get-SPWeb http://portal/sites/subsite1
$qlNav = $web.Navigation.QuickLaunch

$qlNewPreviousSibling = $qlNav | where { $_.Title -eq "Libraries" }
$headingNode = New-Object Microsoft.SharePoint.Navigation.SPNavigationNode("SUBSITE2", "")
$qlNav.Add($headingNode, $qlNewPreviousSibling)

$qlHeading = $qlNav | where { $_.Title -eq "SUBSITE2" }
$linkNode = New-Object Microsoft.SharePoint.Navigation.SPNavigationNode("Subsite2 - Links", "/sites/subsite1/subsite2/Lists/Links/AllItems.aspx")
$qlHeading.Children.AddAsLast($linkNode)

Reference: Managing Quick Launch navigation in SharePoint Foundation using PowerShell

OTHER TIPS

I've just realized, that I can create a title call "Subsites" on my Subsite1. Then create a sub-title for each subsite2 (insubsite1) and call them with the name of the subsite2, and with their url.

But if someone knows a easier way to do it, as .AddQuickLaunch let me know !

EDIT : and btw, when i create the subsite, their is a -AddToquickLaunch with the New-SPWeb command. See this.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top