Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 this issue Sep 3, 2024 · 12 comments

Comments

@till-llit
Copy link

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:

<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2022/09/ProvisioningSchema">
<pnp:Preferences Generator="PnP.Framework, Version=1.17.15.0, Culture=neutral, PublicKeyToken=0d501f89f11b748c" />
<pnp:Templates ID="CONTAINER-TEMPLATE-5E5536E0AF284E9594B8FDE1FAF1C06C">
<pnp:ProvisioningTemplate ID="TEMPLATE-5E5536E0AF284E9594B8FDE1FAF1C06C" Version="0" Scope="Undefined">
pnp:ClientSidePages
<pnp:ClientSidePage PromoteAsNewsArticle="false" PromoteAsTemplate="false" Overwrite="true" Title="PageWithVerticalSection" ThumbnailUrl="" PageName="PageWithVerticalSection.aspx">
<pnp:Header Type="Default" LayoutType="FullWidthImage" ShowTopicHeader="false" ShowPublishDate="false" ShowBackgroundGradient="false" TopicHeader="" AlternativeText="" Authors="" AuthorByLineId="15" />
pnp:Sections
<pnp:Section Order="1" Type="OneColumnFullWidth">
pnp:Controls
<pnp:CanvasControl WebPartType="PageTitle" JsonControlData="..." Order="1" Column="1" />
</pnp:Controls>
</pnp:Section>
<pnp:Section Order="2" Type="OneColumnVerticalSection">
pnp:Controls
<pnp:CanvasControl WebPartType="Text" ControlId="1212fc8d-dd6b-408a-8d5d-9f1cc787efbb" Order="1" Column="1">
pnp:CanvasControlProperties
<pnp:CanvasControlProperty Key="Text" Value="left text" />
</pnp:CanvasControlProperties>
</pnp:CanvasControl>
<pnp:CanvasControl WebPartType="Text" ControlId="4be22244-57dc-4e78-a973-7293e75ef353" Order="1" Column="2">
pnp:CanvasControlProperties
<pnp:CanvasControlProperty Key="Text" Value="vertical text" />
</pnp:CanvasControlProperties>
</pnp:CanvasControl>
</pnp:Controls>
</pnp:Section>
</pnp:Sections>
</pnp:ClientSidePage>
</pnp:ClientSidePages>
</pnp:ProvisioningTemplate>
</pnp:Templates>
</pnp:Provisioning>

@tarjeieo
Copy link

Seeing the same issue.

@paalolav
Copy link

paalolav commented Sep 18, 2024

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
Copy link

paalolav commented Sep 18, 2024

@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:Section Order="1" Type="OneColumnFullWidth">
    pnp:Controls
    <pnp:CanvasControl WebPartType="PageTitle" JsonControlData="..." Order="1" Column="1" />
    </pnp:Controls>
    </pnp:Section>"

  2. (Optional) In the next line, change <pnp:Section Order="2" Type="OneColumnVerticalSection"> to <pnp:Section Order="1" Type="OneColumnVerticalSection">

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

@till-llit
Copy link
Author

@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
Copy link

paalolav commented Sep 23, 2024

@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
Copy link
Contributor

czullu commented Sep 25, 2024

@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
Copy link
Author

@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
Copy link
Contributor

czullu commented Sep 30, 2024

@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
Copy link
Author

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
Copy link
Author

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

@czullu
Copy link
Contributor

czullu commented Sep 30, 2024

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
Copy link
Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@tarjeieo @czullu @paalolav @till-llit and others