Issue with replicating SharePoint Online hub site navigation to other hub sites?

Mohammed 81 Reputation points
2021-01-14T07:11:37.73+00:00

I have requirement to copy the navigation of a SharePoint hub site from one to another. I am currently using the script shared on this blog. It seems to work, but there are instances when it spits out the following error

56511-capture1.png

When it works, I noticed that only one ParentID was being printed out. However when we have multiple ParentID, the error occurs,
Has anyone ever experienced this? I really appreciate the help.

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2021-01-14T09:55:22.86+00:00

    Hi,

    The parameter -Parent only accepts an Int32 so $ParentID cannot be an array. You have to pass one item of the array to the cmdlet each time.
    https://learn.microsoft.com/en-us/powershell/module/sharepoint-pnp/add-pnpnavigationnode?view=sharepoint-ps#parameters

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.