Forum Discussion
PNP provisioning -Updating a list removes it from navigation
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?
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?
- Paul MatthewsBrass Contributor
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.
Thanks.Paul
- Paul MatthewsBrass Contributor
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?