DEV Community

Tony Watters
Tony Watters

Posted on • Edited on

3 1

PnP PowerShell adding navigation links

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" 
}
Enter fullscreen mode Exit fullscreen mode

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

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more