pnp / pnpframework

PnP Framework is a .NET library targeting Microsoft 365 containing the PnP Provisioning engine and a ton of other useful extensions
https://pnp.github.io/pnpframework/
MIT License
206 stars 143 forks source link

Invoke-PnPSiteTemplate: You already have a full width section on this page, you can't add a section with vertical column #1058

Open till-llit opened 1 month ago

till-llit commented 1 month ago

might be related to #1043

PnP.PowerShell 2.10.0

Reproducible on Tenants in Standard Release and Targeted Release.

Steps to Repro:

  1. Communication Site -> New Page -> Blank Template
  2. Add a "Vertical Section" and put a text webpart in both sections (left and vertical). Give the page a Title.
  3. export-pnppage "PageWithVerticalSection.aspx" -Out PageWithVerticalSection.xml
  4. invoke-pnpsitetemplate -path PageWithVerticalSection.xml

Error:

Invoke-PnPSiteTemplate: You already have a full width section on this page, you can't add a section with vertical column

XML Export File:

tarjeieo commented 2 weeks ago

Seeing the same issue.

paalolav commented 2 weeks ago

Same issue here with a customer on targeted release with the branding central (preview). Could it be that PnP Powershell has issues reading and writing the new page header options in SharePoint?

paalolav commented 2 weeks ago

@till-llit I've done some digging. It seems related to the new header in SharePoint pages. Test this please:

  1. Remove the following data from your template" " pnp:Controls

    </pnp:Controls> </pnp:Section>"

  2. (Optional) In the next line, change to

  3. Save the template file and Invoke it. Should work.

till-llit commented 1 week ago

@paalolav : yes, it is related to the new way to save the header as a "OneColumnFullWidth". when i remove it from the template everything works as expected.

i guess the import script must be updated to allow this combination of Controls

paalolav commented 1 week ago

@till-llit We've done further testing. This is a big issue for light provisioning automations at the moment. Hope that the PnP team is on this and updates the import.

czullu commented 1 week ago

@paalolav @till-llit Paalolav is right about the Order. The current Logic is, that the first section shalle be OneColumnFullWith ad the Control in it of Type PageTitle. The reason for the current check is, that the XML-Schema of PNP does not allow to specify the new Header Type and therefore we need to have it under HeaderType-Default and check after the fact. Code line 385 - 398

Have the Pages you have issues with been created new or have they been converted during save from old layout to new? You can check this on Page-Field-History Field CanvasControl1.

The way i understand it, we should be good if i change the code in a way that i check if we have any section of type OneColumnFullWidth with the PageTitle.WebPart in it and then set modern header and reorder the rest of the sections.

till-llit commented 3 days ago

@czullu : i did my tests both, with brand new pages and existing pages. both scenarios fail when there are other sections than onecolumn after the new header section.

czullu commented 3 days ago

@czullu : i did my tests both, with brand new pages and existing pages. both scenarios fail when there are other sections than onecolumn after the new header section.

I mad the fixes for pnpcore and pnpframework and they have been merged to dev branch. You will have to use beta version of pnp powershell until next official release.

till-llit commented 3 days ago

Have the Pages you have issues with been created new or have they been converted during save from old layout to new? You can check this on Page-Field-History Field CanvasControl1.

i was referring to this question in the post before, have not yet tested the dev branch

I mad the fixes for pnpcore and pnpframework and they have been merged to dev branch. You will have to use beta version of pnp powershell until next official release.

im currently trying to figure out how to include the nightly build in our azure function and let you know how it works once im done.

and thank you for your efforts!

till-llit commented 3 days ago

i still see the same error with 2.12.21 nightly PnP.PowerShell

czullu commented 3 days ago

i still see the same error with 2.12.21 nightly PnP.PowerShell

Did you reexport the template-xml? You need to as the detection was to strict and you have wrong header info in xml.

till-llit commented 2 days ago

yes i did - i just tried it again. attached is my exported xml, you should see the same error during import PageWithVerticalSection.xml.txt

(had to mask it as a txt file, github does not like xml)