Month: April 2013

Add heading and link to SharePoint left navigation through powershell

I was wondering whether there is a way to add the heading and link to the left navigation of a SharePoint site using Powershell script. It is feasible, here is the full workable script below:-

$web = Get-SPWeb "http://yourserver:9090/sites/SCO/"
$pubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)

function AddLeftNavHeading($HeadingName,$Link)

$CreateSPNavigationNode = [Microsoft.SharePoint.Publishing.Navigation.SPNavigationSiteMapNode]::CreateSPNavigationNode

$qlNav = $pubWeb.Navigation.CurrentNavigationNodes

$headingNode = $CreateSPNavigationNode.Invoke($HeadingName, $Link, [Microsoft.SharePoint.Publishing.NodeTypes]::Heading, $qlNav)



function AddLeftNavLink($HeadingName,$DisplayName,$URL,$External)

Start-Sleep -Seconds 5

$qlNav1 = $web.Navigation.QuickLaunch

$qlNav1 | select Title, ID

$qlink = $qlNav1 | where {$_.Title -eq $HeadingName}

$linkNode = New-Object Microsoft.SharePoint.Navigation.SPNavigationNode($DisplayName,$URL,$External)



AddLeftNavHeading "Heading" ""
AddLeftNavLink "Heading" "Link" "" "True"

 Subscribe to my blog