pnp / PnP-Sites-Core

Microsoft 365 Dev PnP Core component (.NET) targeted for increasing developer productivity with CSOM based solutions.
Other
415 stars 642 forks source link

Modern Page Provisioning: Get-PnPProvisioningTemplate / Apply-PnPProvisioningTemplate does not save header information #2530

Open dkhmm opened 4 years ago

dkhmm commented 4 years ago

Category

[X] Bug [ ] Enhancement

Environment

[X] Office 365 / SharePoint Online [ ] SharePoint 2016 [ ] SharePoint 2013

PnP PowerShell : 3.17.2001.2

Expected or Desired Behavior

When I export news pages from a site (SitePages/Templates) to another sites sitepage templates, I expect the page header to preserve the properties. (LayoutType / ShowTopicHeader / TopicHeader)

Observed Behavior

The header information is not preserved:

Part of source page: <pnp:ClientSidePage PromoteAsNewsArticle="false" PromoteAsTemplate="true" Overwrite="true" Title="NEWS" ThumbnailUrl="" PageName="Templates/News.aspx" LCID="0"> <pnp:Header Type="Default" LayoutType="NoImage" TextAlignment="Center" ShowTopicHeader="true" ShowPublishDate="false" TopicHeader="Nyhed" AlternativeText="" Authors="[]" AuthorByLine="[]" AuthorByLineId="-1" />

From: <pnp:Header Type="Default" LayoutType="NoImage" TextAlignment="Center" ShowTopicHeader="true" ShowPublishDate="false" TopicHeader="Nyhed" AlternativeText="" Authors="[]" AuthorByLine="[]" AuthorByLineId="-1" /> To: <pnp:Header Type="Default" LayoutType="FullWidthImage" TextAlignment="Center" ShowTopicHeader="false" ShowPublishDate="false" TopicHeader="" AlternativeText="" Authors="[]" AuthorByLine="[]" AuthorByLineId="-1" />

Steps to Reproduce

$site1 = Connect-PnPOnline -Url "https://tenant.sharepoint.com/sites/SiteName" -ReturnConnection

Get-PnPProvisioningTemplate -Out .\SavePageTemplate.xml -PersistBrandingFiles -IncludeAllClientSidePages -Handlers PageContents,Pages -Force -Connection $site1

$siteurlCurrent = Connect-PnPOnline -Url "https://tenant.sharepoint.com/sites/SiteName" -ReturnConnection Apply-PnPProvisioningTemplate -Path .\SavePageTemplate.xml -Connection $siteurlCurrent

Best Regards Henrik

ghost commented 4 years ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

deanbot commented 4 years ago

Possibly related, Export-PnPClientSidePage isn't pulling down the correct <pnp:Header xml.

I've noticed this with the Type property.

I.e.

Set-PnpClientSidePage -Identity "Search" -HeaderType None
Export-PnPClientSidePage -Identity "Search" -Out search-page.xml

renders the following xml (note that Type is set to Default instead of None)

<pnp:ClientSidePage PromoteAsNewsArticle="false" PromoteAsTemplate="false" Overwrite="true" EnableComments="false" Title="Search" ThumbnailUrl="" PageName="Search.aspx">
  <pnp:Header Type="Default" LayoutType="NoImage" TextAlignment="Center" ShowTopicHeader="false" ShowPublishDate="false" TopicHeader="" AlternativeText="" Authors="[]" AuthorByLine="[]" AuthorByLineId="-1" />
  ...
</pnp:ClientSidePage>

I'm using SharePointPnPPowerShellOnline 3.17.2001.2