PNP provisioning -Updating a list removes it from navigation

Brass Contributor

I'm not sure if this is the right place to ask, but we are currently using PNP templates to provision our document libraries in different sites. 


We needed to update a document library on our sites, so we trimmed down the original PNP XML template just to have the ListInstance information that we had before, with the updated changes in it.


However, we have noticed that after we apply the updated PNP XML template to the site just to update the library, if the library originally had a link to it in the left hand navigation, it gets removes.


We cannot just include left hand navigation in the template, as each site has been modified over time and each site has different Left Hand Navigation links.


Is this a bug in PNP?

12 Replies

Hi @Paul Matthews,


Are you doing something like this:

PS U:\> Get-PnPProvisioningTemplate -Handlers Lists -Out u:\testlists.xml
PS U:\> 
PS U:\> Apply-PnPProvisioningTemplate -Path u:\testlists.xml

My navigation remains in tact. Can you share your template?

Hi Pieter,

 Thank you for replying. I've tried to break my code down further with an example to be able to share with you, and as you have found the left hand navigation remains. 


Leave it with me, and I'll get you an example that does what I'm experience, or I will work out and understand why it's happening and post my findings to help someone else.




Hi @Pieter Veenstra

 I have been able to replicate our problem. I provide you with 3 files.

PNP problem files in my OneDrive


From a brand new site collection using the classic Team site. 

Apply-PnPProvisioningTemplate -Path:'./otbsite.xml' -Verbose

This will create a new list called 'Show on Nav', and included on the left hand navigation. I have also changed the homepage to be a modern page. (Welcome.aspx).


After you have done this run

Apply-PnPProvisioningTemplate -Path:'./otbsite.1.xml' -Verbose

This then updates the 'Show on Nav' views to include the version column. After this is run, the left hand navigation no longer shows 'Show on Nav'. 


It looks like it's to do with the view Url, as we are using this template on multiple tenants, multiple site collections, we removed the original Url as '/sites/PNPTemplate/Show on Nav/Forms/AllItems.aspx' to '{site}/Show on Nav/Forms/AllItems.aspx'


However, after running the template otbsite.1.xml again and replacing the URL of the view from {site}/Show on Nav/Forms/AllItems.aspx' with '/site/blah/Show on Nav/Forms/AllItems.aspx' it doesn't remove from the left navigation, and the views still seem to work OK.


Still having an issue with Lists though.


Even though I have worked out the problem, do you think this is an error in PNP or SharePoint itself?

Hi @Paul Matthews,


I ran both xml templates and my show on nav list is still in the left hand navigation. 



Hi @Pieter Veenstra

 I do appreciate you helping me with this. I made a mistake on the original otbsite.1.xml template, the List Instance had 'OnQuickLaunch="true". So originally the link was sub heading underneath the Documents navigation. After you ran the second template it put back, but at the bottom of all the links. (I was also caught out by this, and why I think putting '/sites/blah/' worked. It did not)


BeforeBefore reapplying.PNG


After applying.PNG


I have since update otbsite.1.xml in my onedrive, it no longer has the 'OnQuickLaunch' in the template. Now when you run it you should experience the same problem I'm getting where the link disappears from the Navigation. Please grab new copy and run otbsite.xml followed by otbsite.1.xml again.


When I look at the verbose longs for the PNP, it always says it's "Creating" a view, never updating. Didn't know if this was the reason, perhaps the view I'm pointing to is deleted before recreated, as soon as it's deleted, SharePoint is removing any navigation links to it?


HI @Paul Matthews,


Ah, ok now I understand. Yes I think I've seen this a while back too. If I remember correctly the navigation options are removed before the option is applied. In the past ( about 2 years ago) we ended up with multiple entries for the Libraries that appear in the left hand nav. I thought that there was a switch in the template that allows you to make sure that the navigation isn't removed. But I don't think that option is available at the list level. Only within the navigation sections of the template there is switch to remove or not remove the existing links.


Hi @Pieter Veenstra

 So is this a bug? Do I need to add it to an issue list in PNP? Or is that just the way it is?



I would classify this is a missing feature. Maybe within PnP we could rather than 'delete it optionally add it' have an option within the template to keep the list navigation setting 'as it is currently'.

I'm not sure I fully understand what is happening then.


In the second template otbsite.1.xml I'm not putting anything in there regards to the navigation. So why modifying the list would automatically remove it from the navigation? Is it like I said, because the views are deleted and recreated? Or is something else going on?

I think that the  navigation link is removed before it is readded. This would allow the application of the template to make changes to the item in the navigation. So for example if the Url changed or if the display text changed.

So when the list is being re-applied, it removes the navigation link, just in case you have added it back in the navigation section?

My second template didn't have any navigation section. It would be better if it just left the navigation alone.