How to add a Navigation link with child links to numerous sites with PnP PowerShell
$tenantUrl = "https://YOURTENENT.sharepoint.com/" $cred = Get-Credential $sites = "Site1", "Site2", "Site3", "Site4" foreach($name in $sites) { Connect-PnPOnline -Url "$tenantUrl/sites/$name/SitePages/" -Credentials $cred Add-PnPNavigationNode -Title "Parent Link" -Url "$tenantUrl/sites/mysite/SitePages/somesite1.aspx" -Location "QuickLaunch" Add-PnPNavigationNode -Title "Child one" -Url "$tenantUrl/sites/mysite/SitePages/somesite2.aspx" -Location "QuickLaunch" -Header "Parent Link" Add-PnPNavigationNode -Title "Child two" -Url "$tenantUrl/sites/mysite/SitePages/somesite3.aspx" -Location "QuickLaunch" -Header "Parent Link" Add-PnPNavigationNode -Title "Child three" -Url "$tenantUrl/sites/mysite/SitePages/somesite4.aspx" -Location "QuickLaunch" -Header "Parent Link" Add-PnPNavigationNode -Title "Child four" -Url "$tenantUrl/sites/mysite/SitePages/somesite5.aspx" -Location "QuickLaunch" -Header "Parent Link" }
Checkout these excellent PowerShell resources
My good friend Velin Georgiev blog is an excellent resource on all things SharePoint
https://blog.velingeorgiev.com/provision-custom-list-sharepoint-pnp-powershell
Also found this great Cheat sheet
http://compari.tech/powershell
Top comments (0)