pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
988 stars 662 forks source link

Add-PnPNavigationNode executed on the root site collection cannot find sites in /sites/ #2225

Open simoncrelling opened 5 years ago

simoncrelling commented 5 years ago

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:

  1. Are you using Apply-SPOProvisioningTemplate or Get-SPOProvisioningTemplate? 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/officedev/PnP-Sites-Core/issues.
  2. Is the issue related to the cmdlet itself, its parameters, the syntax, or do you suspect it is the code of the cmdlet that is causing the issue? Then please continue reporting the issue in this repo.
  3. If you think that the functionality might be related to the underlying libraries that the cmdlet is calling (We realize that might be difficult to determine), please first double check the code of the cmdlet, which can be found here: https://github.com/OfficeDev/PnP-PowerShell/tree/master/Commands. If related to the cmdlet, continue reporting the issue here, otherwise report the issue at https://github.com/officedev/PnP-Sites-Core/issues

Reporting an Issue or Missing Feature

Please confirm what it is that your reporting Using version 3.12.1908.1 When trying to add navigation nodes to a communication site in the tenant root, the command fails with: Add-PnPNavigationNode : Cannot open "/sites/<sitename>": no such file or folder.

Expected behavior

Please describe what output you expect to see from PnP-PowerShell Cmdlets The node is added to the menu.

Actual behavior

Please describe what you see instead. Please provide samples of HTML output or screenshots The node is not added to the menu and an error occurs.

Steps to reproduce behavior

Please include complete code samples in-line or linked from gists I've created another communication site in the /sites/ location, registered it as a hub site and ran the same code, the node is added to the menu. If I do this in the root site collection it fails. The root site collection has been swapped to a modern communication site via Invoke-SPOSiteSwap.

Which version of the PnP-PowerShell Cmdlets are you using?

What is the version of the Cmdlet module you are running?

(you can retrieve this by executing Get-Module -Name *pnppowershell* -ListAvailable)

How did you install the PnP-PowerShell Cmdlets?

ghost commented 5 years ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

ScoutmanPt commented 5 years ago

Hi , we are having the same behaviour. Even on GUI on the page , so it seems something internal . [UPDATE] I've try also with CSOM and the result is "Exception calling "ExecuteQuery" with "0" argument(s): "The remote server returned an error: (403) Forbidden." although im a Global Admin

simoncrelling commented 5 years ago

I'm not seeing the issue via GUI so this could be an additional problem with your site. SharePoint does have a status incident today (for us at least). I've just tried adding a node on the root site collection via the GUI on my dev tenant and it worked, still not working via PowerShell.

ScoutmanPt commented 5 years ago

Howdy again, the issue happens on a child node whenever u add a url. The root node u add it was a header or a url?

simoncrelling commented 5 years ago

It was a url. For me the problem concerns nodes that have urls that contain /sites/ (when ran on the root site collection). The site is also a Hub site if that matters.

E.G.:

Connect-PnPOnline -Url "https://<myTenant>.sharepoint.com" -UseWebLogin

Add-PnPNavigationNode -Title "This One Fails" -Url "https://<myTenant>.sharepoint.com/sites/fail" -Location TopNavigationBar

Add-PnPNavigationNode -Title "This One Works" -Url "https://<myTenant>.sharepoint.com/sitepages/this-one-works.aspx" -Location TopNavigationBar

Add-PnPNavigationNode -Title "Headers Also Work" -Url "http://linkless.header/" -Location TopNavigationBar
gautamdsheth commented 5 years ago

Can you try after setting External flag ?

Add-PnPNavigationNode -Title "This One Fails" -Url "https://<myTenant>.sharepoint.com/sites/fail" -Location TopNavigationBar -External

simoncrelling commented 5 years ago

Adding the -External flag worked, thanks @gautamdsheth I wonder why this is required here but not on a hub site in the /sites/ path?

almokhlsany commented 5 years ago

Adding the -External flag worked, thanks @gautamdsheth and thanks @simoncrelling