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 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.UpdateYou can alter the script to add new link to all sites in a site collection.
No comments:
Please Login and comment to get your questions answered!