Saturday, April 25, 2015

Add a Link to SharePoint Top Navigation Menu or Quick Launch using PowerShell

Requirement: Add a new link to SharePoint Global Navigation (Top Link Bar) or Quick Launch using PowerShell.

Add link to SharePoint Top Navigation using PowerShell:

Add-PSSnapin Microsoft.SharePoint.PowerShell –ErrorAction SilentlyContinue

#Variables for processing
$WebURL="http://sharepoint.crescent.com/teams/marketing"
$NavigationTitle="Employee Profile"
$NavigationLink="https://peoplesoft.crescent.com/employee/profile.aspx"

#Get the Web
$Web= Get-SPWeb $WebURL

#Get Top Navigation
$TopNavigation = $Web.Navigation.TopNavigationBar
#For Quick Launch, Use: Navigation.QuickLaunch

#Create a New Top Navigation Node
$node = New-Object Microsoft.SharePoint.Navigation.SPNavigationNode($NavigationTitle, $NavigationLink, $true)

#Add the Node
$TopNavigation.AddAsLast($node)

#Set the Target Property - Will work only when Publishing features is enabled
$node.Properties["Target"] = "_blank"

$node.Update
You can alter the script to add new link to all sites in a site collection.



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...