Invoke-PnPSiteTemplate fails with "The property or field 'HeaderLayout' has not been initialized"
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 259
- Forks
- 161
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 1
Description
Hello,
when I export a site template via the "Get-PnPSiteTemplate -IncludeAllClientSidePages -PersistBrandingFiles -PersistPublishingFiles" command and then try to invoke it on another site the issue occurs.
Invoke-PnPSiteTemplate : The property or field 'HeaderLayout' has not been initialized. It has not been requested or
the request has not been executed. It may need to be explicitly requested.
At line:1 char:1
Invoke-PnPSiteTemplate -Path C:\Temp\spo\PNP2\PnpTemplate.xml -ClearN ...
CategoryInfo : WriteError: (:) [Invoke-PnPSiteTemplate], PropertyOrFieldNotInitializedException
FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.Provisioning.Site.InvokeSiteTemplate
I tried the nighly builds to export a "extended" header. So the header section in the export looks like this:
<pnp:Header Layout="Extended" MenuStyle="MegaMenu" BackgroundEmphasis="Strong" ShowSiteTitle="false" ShowSiteNavigation="false" />
I was able to reproduce it in 1.8.62 abd 1.8.61. I am trying with SharePoint Online modern sites
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure by exporting with Get-PnPSiteTemplate using the shown switches, then invoking the resulting PnpTemplate.xml with Invoke-PnPSiteTemplate. Trace how the exported pnp:Header element and its HeaderLayout property are handled; done means the template invokes successfully on another SharePoint Online modern site.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100