Forum Discussion
Ivan54
Feb 08, 2019Bronze Contributor
Copy/Export Navigation?
Is there a PowerShell command (or other way) to export a hub site navigation and import it to another hub site navigation?
Darren_Smith
Sep 30, 2020Copper Contributor
Saeid_Abdollahzadeh I just ran this module and got the following message "Backup process is done, you can find the back up file in the destination folder" and "You skip the restore process". Currently, I cannot find the backup excel file and the navigation in the destination site was not changed. Any idea what I'm missing here? Thanks
Saeid_Abdollahzadeh
Oct 01, 2020Copper Contributor
Hi Darren_Smith
Copy-PNPNavigation -SourceSite https://contoso.sharepoint.com/sites/SourceSite -BackupDestination C:\FolderOfBackupFile -DestinationSite https://contoso.sharepoint.com/sites/DestinationSite -NavigationLocation TopNavigationBar
It's the full line of the command. You have to enter the source site address, which you want to copy the navigation from it, then you need to enter the destination folder where the backup file will save there. If you're going to add the navigation menu to the destination site, you have to use the -DestinationSite switch, otherwise the backup file doesn't copy to the destination site, and you have the backup file only!
https://github.com/saeid-adz/Copy-PNPNavigation
BR,
Saeid.
- Darren_SmithOct 01, 2020Copper Contributor
Saeid_Abdollahzadeh Hi Saeid, thanks so much for your reply and the clarification. When running the command, I now get an error 'D:\SiteNavigationBackup.xlsx' file not found. When viewing the directory, the backup file was never written. Am I missing something?
- Saeid_AbdollahzadehOct 02, 2020Copper Contributor
Hi again Darren_Smith
I suggested that you use a specific folder instead of the drive path for the backup file! for example:
Copy-PNPNavigation -SourceSite https://YourSourceSite.sharepoint.com -BackupDestination C:\Backup -DestinationSite https://YourDestinationSite.sharepoint.com/sites/TEST -NavigationLocation TopNavigationBar
You will see the "SiteNavigationBackup.xlsx" in the Backup folder!
It should be fixed by this command!
Also, make sure that you use version 1.0.2
good luck 🙂
BR,
Saeid.
- rgs-studio365Feb 17, 2024Copper Contributor
Saeid_Abdollahzadeh - I just tried your module after making a couple modifications and it worked great. Updated changes needed where:
- Replace -UseWebLogin with -Interactive (so it supports MFA login)
- Replace SharePointPnPPowerShellOnline with PnP.Powershell
I'm new to Github, so not sure if i did this right, but made the corrections in fork at
Comparing saeid-adz:master...robert-studio365:patch-1 · saeid-adz/Copy-PNPNavigation (github.com)
Also took me awhile to figure this out, but using "-NavigationLocation QuickLaunch" instead of "-NavigationLocation TopNavigationBar" also worked great with this module.
Thanks for sharing.
- Darren_SmithOct 01, 2020Copper Contributor
Saeid_Abdollahzadeh also, just to clarify, I'm running Powershell as an admin