Quantcast
Channel: Microsoft Online: SharePoint Online forum
Viewing all articles
Browse latest Browse all 10096

How to Programmatically Add a Global Navigation Link in Sharepoint 2013 Online 365 using Powershell 5

$
0
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”.

Referencing the diagram below, I need the icon for the new link to look like 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”

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 10096

Trending Articles



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