Closed jooaij closed 4 years ago
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
I opened a PR to PnP-Sites-Core to fix the issue.
In the meantime you can workaround the issue by calling Get-PnPWeb -Include ServerRelativeUrl
before Add-PnPNavigationNode
Here's an example with the workaround:
Thanks for the workaround! That helped to add a single footer link (as in the simplified example), but in my full script I was adding multiple links on a site. For that purpose I had to modify it slightly:
$web = Get-PnPWeb -Include ServerRelativeUrl Set-PnPFooter -Enabled:$true foreach($link in $footerLinks){ Add-PnPNavigationNode -Location 'Footer' -Title $link.Title -Url $link.Url -External $web.Update() }
Notice: many issues / bugs reported are actually related to the PnP Core Library which is used behind the scenes. Consider carefully where to report an issue:
Apply-PnPProvisioningTemplate
orGet-PnPProvisioningTemplate
? The issue is most likely related to the Provisioning Engine. The Provisioning engine is not located in the PowerShell repo. Please report the issue here: https://github.com/pnp/PnP-Sites-Core/issues.Reporting an Issue or Missing Feature
Issue
Expected behavior
New navigation links are expected to be created in target SharePoint site's footer.
Actual behavior
Links are not created. Error message raised by the commandlet is "The property or field 'ServerRelativeUrl' has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested."
Steps to reproduce behavior
Error occurs when running lines of code such as: Connect-PnPOnline -Url $siteUrl Set-PnPFooter -Enabled:$true Add-PnPNavigationNode -Location Footer -Title $link.Title -Url $link.Url -External
Which version of the PnP-PowerShell Cmdlets are you using?
What is the version of the Cmdlet module you are running?
3.24.2008.1
How did you install the PnP-PowerShell Cmdlets?