PnP-PowerShell icon indicating copy to clipboard operation
PnP-PowerShell copied to clipboard

pnp:StructuralNavigation causes duplicate entries in navigation

Open cheindel opened this issue 9 years ago • 4 comments

Reporting an Issue or Missing Feature

  • Issue

Expected behavior

  1. Create standard team site via central administration
  2. Add additional lists like "Calendar", "Tasks", ...
  3. The lists will show up in the structural navigation on the left side
  4. Extract the template via Get-PnPProvisioningTemplate -Out template.pnp -IncludeSiteCollectionTermGroup -PersistBrandingFiles -PersistComposedLookFiles
  5. Create a target team site via PowerShell (New-SPSite)
  6. Import template via Apply-PnPProvisioningTemplate
  7. Source and target should look identical

Actual behavior

Beginning with Januar 2017 Release there will be sections like this in the extracted template:

<pnp:CurrentNavigation NavigationType="StructuralLocal">
          <pnp:StructuralNavigation RemoveExistingNodes="false">
            <pnp:NavigationNode Title="Home" Url="{site}" />
            <pnp:NavigationNode Title="Aufgaben" Url="{site}/Lists/Aufgaben/AllItems.aspx" />
            <pnp:NavigationNode Title="Documents" Url="{site}/Shared Documents/Forms/AllItems.aspx" />
            <pnp:NavigationNode Title="Kontakte" Url="{site}/Lists/Kontakte/AllItems.aspx" />
            <pnp:NavigationNode Title="Kalender" Url="{site}/Lists/Kalender/calendar.aspx" />
          </pnp:StructuralNavigation>
</pnp:CurrentNavigation>

Now if you apply the template the following will happen:

  1. Additional lists will be created and automatically added to the structural navigation
  2. Additionally navigation nodes will be added at the end of the provisioning process
  3. The structural navigation contains duplicates

Steps to reproduce behavior

  • You can reproduce the issue be following the steps described above.
  • If you manually set "RemoveExistingNodes" to TRUE the navigation nodes will be ok. However, this will be problematic if applying the PnP template on an existing template where other customizations to the navigation migth have happened.
  • Maybe the provisioning engine or the PowerShell CMDLETs could create lists without automatically adding the the structural navigation and only handle it via pnp:CurrentNavigation OR automatically exclude them from pnp:CurrentNavigatoin?

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

  • [X] PnP PowerShell for SharePoint 2013
  • [ ] PnP PowerShell for SharePoint 2016
  • [ ] PnP PowerShell for SharePoint Online

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

  • January 2017 Release (2.11.1701.1)

How did you install the PnP-PowerShell Cmdlets?

  • [X] MSI Installed downloaded from GitHub
  • [ ] Installed through the PowerShell Gallery with Install-Module
  • [ ] Other means

cheindel avatar Jan 19 '17 12:01 cheindel

I have the same issue. It seems that selecting a "structural navigation" makes the provisioning engine create nodes for every subsites even if the source site don't have them. This should not be the expected behavior as this would pollute the navigation with undesirable links. The apply cmdlet crashes because the destinations of the nodes to the subsites don't necessarily exists at destination.

PzKfWg avatar May 09 '17 14:05 PzKfWg

We had a long internal discussion about this and decided to implement it this way. If you want to overwrite the existing navigation nodes (by default we do not remove artifacts, which is the reason we add to the existing navigational structure), you will have to specify the -ClearNavigation switch. The engine does not create nodes for subwebs, if that occurs, then it's the server doing that.

erwinvanhunen avatar May 09 '17 14:05 erwinvanhunen

We closed this issue as it had not activity within last 180 days. This is a generic process we have decided to perform for issues, which have not been explicitly marked still to be "work in progress" based on tags. We are performing this cleaning to make sure that old issues that have already been solved (but not closed) or are no longer relevant are cleaned out and make the issues more manageable. If this issue still valid, we would ask you to open a new issue and follow the guidance in the issue template related on the recommended location. We do apologize any inconveniences this might cause. Please do remember that issues in the issue lists are also messages for others in the community, so you can also check if you can assist on any of them. “Sharing is caring!”

spdevdocs avatar Apr 28 '18 14:04 spdevdocs

I am still experiencing this issue. any solution yet?

soniya-khatri avatar Dec 04 '19 01:12 soniya-khatri