pnpframework icon indicating copy to clipboard operation
pnpframework copied to clipboard

Invoke-PnPSiteTemplate fails with "The property or field 'HeaderLayout' has not been initialized"

Open MichalskiM opened this issue 3 years ago • 3 comments

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

MichalskiM avatar Dec 09 '21 14:12 MichalskiM

Small update, when I change the header style to "Compact" it works.

This works: <pnp:Header Layout="Compact" MenuStyle="MegaMenu" BackgroundEmphasis="Strong" ShowSiteTitle="false" ShowSiteNavigation="false" /> This doesn't <pnp:Header Layout="Extended" MenuStyle="MegaMenu" BackgroundEmphasis="Strong" ShowSiteTitle="false" ShowSiteNavigation="false" />

MichalskiM avatar Dec 09 '21 15:12 MichalskiM

i have the same problem. In my case it doesn't work with Minimal.

<pnp:Header Layout="Minimal" MenuStyle="MegaMenu" ShowSiteTitle="false" ShowSiteNavigation="false" />

Rtoribiog avatar Dec 25 '21 08:12 Rtoribiog

I was looking also at this issue on PnP.Framework code and found a pull request to fix this

Pull request: https://github.com/pnp/pnpframework/pull/562

The pull request will fix the missing types "Minimal" and "Extended", that's why is working for some options "Standard" and "Compact"

About the "The property or field 'HeaderLayout' has not been initialized" I commented on the pull request about this.

PedroMordeP avatar Jan 11 '22 18:01 PedroMordeP