Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

SharePoint 365 Online Using Powershell top add Links to Global Navigation Bar

$
0
0

I am trying to modify a PowerShell 5 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”.

Referencing the diagram below, I need the new link to appear as the example “Link1” Currently I can only add a header with the attached script which appears like the example “Hello1” below. Does anyone know how I can modify my script to make the Global Navigation item appear as a link?

Script which adds a “Header” such as "Hello1" above:

siteUrl = $_.Url

$siteTitle = $_.Title

$context =New-ObjectMicrosoft.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-ObjectMicrosoft.SharePoint.Client.NavigationNodeCreationInformation

$NavigationNode.Title = $ItemName

$NavigationNode.Url = $ItemUrlPath

$NavigationNode.AsLastNode = $true          

$context.Load($NavBar.Add($NavigationNode))

$context.ExecuteQuery()  


gm.ca


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>