0

I am trying to modify a PowerShell script to add Links to the SharePoint 365 online Global Navigation bar of my sites. I currently have a script which will add a Header to the Global Navigation Bar, but rather than add “headers”, I need to modify it to add “Links”.

I need the new link to appear as the example “Link1” Currently I can only add a header with the attached script which appears as a yellow folder icon. Does anyone know how I can modify my script to make the Global Navigation item appear as a link (icon of globe with chain link)when viewed from within Settings, Site Settings, Navigation?

Script which adds a “Header”:

siteUrl = $_.Url
$siteTitle = $_.Title
$context = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
$context.Credentials = $credentials
$context.RequestTimeOut = 5000 * 60 * 10;
$web = $context.Web
$site = $context.Site
$context.Load($web)
$context.Load($site)
$context.ExecuteQuery()

$NavBar = $context.Web.Navigation.TopNavigationBar
$NavigationNode = New-Object Microsoft.SharePoint.Client.NavigationNodeCreationInformation
$NavigationNode.Title = $ItemName
$NavigationNode.Url = $ItemUrlPath
$NavigationNode.AsLastNode = $true
$context.Load($NavBar.Add($NavigationNode))
$context.ExecuteQuery()

(Visited 39 times, 1 visits today)
Add a Comment