powershell
                                
                                 powershell copied to clipboard
                                
                                    powershell copied to clipboard
                            
                            
                            
                        Export-PnpPage keeps the default header type instead of the correct type.
Expected behavior
Export-PnPPage templates/Template.aspx -Out Template.xml
Returns:
<pnp:Header Type="Default" LayoutType="NoImage" TextAlignment="Center" ShowTopicHeader="false" ShowPublishDate="false" TopicHeader="" AlternativeText="" Authors="[]" AuthorByLine="[]" AuthorByLineId="-1" />
Since the header Type is Default, SharePoint will ignore parameters like LayoutType and TextAlignment . To workaround we need to change the type to Custom
Steps to reproduce behavior
- Create a page and make any change to the header ( align text center or remove the image)
- Export the template Export-PnPPage templates/Template.aspx -Out Template.xml
- Provision the template.
What is the version of the Cmdlet module you are running?
PnP.Powershell 1.9.0
Which operating system/environment are you running PnP PowerShell on?
- [x] Windows
- [ ] Linux
- [ ] MacOS
- [ ] Azure Cloud Shell
- [ ] Azure Functions
- [ ] Other : please specify
@Dangerous-Mind - is this still an issue ? Can you please try with latest release and let us know ?
@gautamdsheth, just confirmed with version 1.10.0
A page with the 'NoImage' layout is still being exported as <pnp:Header Type="Default" LayoutType="NoImage" ShowTopicHeader="false"... which actually should be <pnp:Header Type="Custom" LayoutType="NoImage" ShowTopicHeader="false" using the command Get-PnPSiteTemplate -Out ./test.xml -Handlers PageContents,Pages -IncludeAllPages
I can confirm this issue on 1.11. We have an workaround for our page migration script, by rebuilding the template (get it via Export-PnPPage) in the following way:
[xml]$xml = $template $newAttr = $xml.CreateAttribute('ServerRelativeImageUrl') $xml.Provisioning.Templates.ProvisioningTemplate.ClientSidePages.ClientSidePage.Header.Attributes.Append($newAttr) $xml.Provisioning.Templates.ProvisioningTemplate.ClientSidePages.ClientSidePage.Header.ServerRelativeImageUrl="/sites/demo1/assets/myimage.png" $xml.Provisioning.Templates.ProvisioningTemplate.ClientSidePages.ClientSidePage.Header.Type = 'Custom' $xml.OuterXml | Out-File -FilePath './pageTemplate.xml' -Force
after this manipulation we can successfully use Invoke-PnPSiteTemplate
In our case, we have the page header with no image, but with TopicHeader (this prop is successfully exported via cmdlet)
Hi Team, Any update on this issue ? I believe this even exists when you export-pnpsitetemplate....
Thanks, Divyansh
This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days
Still no news?
Can you please update to the latest 2.1.x however PS 7.2 or later is needed to benefit from all the bug fixes and improvements of that new release.
PS5 support has been dropped.
Feel free to reopen if the issue persists. Thanks.
This appears to still be an issue on PNP version 2.2