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

ClientSidePages ex- and re-import does not work when M365 Rodmap feature 386904 is active in the tenant #1043

Closed
nils-a opened this issue Jul 25, 2024 · 14 comments

Comments

@nils-a
Copy link
Contributor

nils-a commented Jul 25, 2024

Feature 386904

SharePoint: New Banner web part (updated title area) in SharePoint Pages and News

We’ve made some improvements to the title area on top of the page experience. 1 – Title area is removable now, which is no longer required on your page. 2 – Rebranded the title area as a Banner web part with new layouts! You can add one or more banner(s) to any column of your page, including a full-width section.

Feature ID: 386904
Added to roadmap: 3/8/2024
Last modified: 7/3/2024
Product(s): SharePoint
Cloud instance(s): GCC, Worldwide (Standard Multi-Tenant), GCC High, DoD
Platform(s): Web
Release phase(s): General Availability, Targeted Release

Steps to reproduce

  1. Create a new page, not using a template. Add a title and add some text below it.
  2. connect-pnponline -Interactive <yoursite>
  3. export-PnPPage "<yourpage>.aspx" -out test.xml
  4. The exported page contains the new PageTitle webpart, in a OneColumnFullWidth section.
         <!-- some xml here -->
         <pnp:ClientSidePage PromoteAsNewsArticle="false" PromoteAsTemplate="false" Overwrite="true" Title="Hier ein anderer Titel" ContentTypeID="..." ThumbnailUrl="" PageName="Hier-Ein-anderer-Titel.aspx">
           <pnp:Header Type="Default" LayoutType="FullWidthImage" ShowTopicHeader="false" ShowPublishDate="false" ShowBackgroundGradient="false" TopicHeader="" AlternativeText="" Authors="" AuthorByLineId="17" />
           <pnp:Sections>
             <pnp:Section Order="1" Type="OneColumnFullWidth">
               <pnp:Controls>
                 <pnp:CanvasControl WebPartType="PageTitle" JsonControlData="..." ControlId="..." Order="1" Column="1" />
               </pnp:Controls>
             </pnp:Section>
             <pnp:Section Order="2" Type="OneColumn">
               <pnp:Controls>
                 <pnp:CanvasControl WebPartType="Text" ControlId="..." Order="1" Column="1">
                   <pnp:CanvasControlProperties>
                     <pnp:CanvasControlProperty Key="Text" Value="Hier ein Text…" />
                   </pnp:CanvasControlProperties>
                 </pnp:CanvasControl>
               </pnp:Controls>
             </pnp:Section>
           </pnp:Sections>
         </pnp:ClientSidePage>
         <!-- more xml here -->
  5. invoke-pnpsitetemplate -path test.xml
  6. An error occurs:

    Invoke-PnPSiteTemplate: You cannot host text controls inside a one column full width section, only an image web part or hero web part are allowed

@nils-a
Copy link
Contributor Author

nils-a commented Jul 25, 2024

Additionally, when using page-templates created from a pnp-template, "strange" things happen to the title:

  1. use the following xml to create a new template:
<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2022/09/ProvisioningSchema">
  <pnp:Preferences Generator="PnP.Framework, Version=1.15.95.0, Culture=neutral, PublicKeyToken=0d501f89f11b748c" />
  <pnp:Templates ID="CONTAINER-TEMPLATE-79AA4DF1BA094052A6169EA560E53F36">
    <pnp:ProvisioningTemplate ID="TEMPLATE-79AA4DF1BA094052A6169EA560E53F36" Version="0" Scope="Undefined">
      <pnp:ClientSidePages>
        <pnp:ClientSidePage PromoteAsNewsArticle="false" PromoteAsTemplate="true" Overwrite="true" Title="New Test" ThumbnailUrl="" PageName="Templates/New-Test.aspx">
          <pnp:Header Type="Default" LayoutType="FullWidthImage" ShowTopicHeader="false" ShowPublishDate="false" ShowBackgroundGradient="false" TopicHeader="" AlternativeText="" Authors="" AuthorByLineId="17" />
          <pnp:Sections>
            <pnp:Section Order="1" 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="Some text here" />
                  </pnp:CanvasControlProperties>
                </pnp:CanvasControl>
                <pnp:CanvasControl WebPartType="Text" ControlId="1212fc8d-dd6b-408a-8d5d-9f1cc787efbc" Order="1" Column="2">
                  <pnp:CanvasControlProperties>
                    <pnp:CanvasControlProperty Key="Text" Value="Some text in the left colum" />
                  </pnp:CanvasControlProperties>
                </pnp:CanvasControl>
              </pnp:Controls>
            </pnp:Section>
            <pnp:Section Order="2" Type="OneColumn">
              <pnp:Controls>
                <pnp:CanvasControl WebPartType="Text" ControlId="1212fc8d-dd6b-408a-8d5d-9f1cc787efbd" Order="1" Column="1">
                  <pnp:CanvasControlProperties>
                    <pnp:CanvasControlProperty Key="Text" Value="more text here" />
                  </pnp:CanvasControlProperties>
                </pnp:CanvasControl>
              </pnp:Controls>
            </pnp:Section>
          </pnp:Sections>
        </pnp:ClientSidePage>
      </pnp:ClientSidePages>
    </pnp:ProvisioningTemplate>
  </pnp:Templates>
</pnp:Provisioning>

(Kindly ignore, that the text saying "Some text in the left colum" actually is in the right column and contains a typo. 🙄)

  1. Create a new page from that template. Should look something like this:
    image

  2. Save the page, the re-load:
    Magic happens...
    image

now, the fun begins...

  • Edit the page-template, any change will do, and save it
  • Create a new page from the template - the error is gone.
  • Upate the title of the page-template by calling Set-PnPPage "Templates/<my-template>.aspx" -Title "new new title" - now the whole page-template has two titles...
    image

@Raven081189
Copy link

Hi,

i have opened a similar issue here:
#1045 (comment)

@cwparsons
Copy link

I also noticed the same thing in #1038.

@marcoschmucker
Copy link

We have the same thing on tenants where the new section possibilities and banner webparts are available - but not too many have that at this point of time.

Workaround: Remove the full width section in page templates, use a normal section with Text webpart. After provisioning make sure people add the full width section with banner. Not nice.

Any updates? @nils-a @cwparsons?

@nils-a
Copy link
Contributor Author

nils-a commented Aug 14, 2024

None. We're currently alternating between not using PnP provisioning at all, and provisioning using PnP with additional manual "cleanup".

@czullu
Copy link
Contributor

czullu commented Aug 14, 2024

The specific Stacktrace for that Error
[2024-08-14T13:00:35.428Z] Message = **You can't use a OneColumnFullWidth section in this site template (GROUP)** [2024-08-14T13:00:35.433Z] Source = PnP.Core [2024-08-14T13:00:35.435Z] Error = PnP.Core.ClientError [2024-08-14T13:00:35.438Z] TargetSite = Void MoveNext() [2024-08-14T13:00:35.440Z] HResult = -2146233088 [2024-08-14T13:00:35.442Z] StackTrace = **at PnP.Core.Model.SharePoint.Page.ValidateOneColumnFullWidthSectionUsageAsync()** [2024-08-14T13:00:35.448Z] at PnP.Core.Model.SharePoint.Page.SaveAsync(String pageName) [2024-08-14T13:00:35.452Z] at PnP.Core.Model.SharePoint.Page.Save(String pageName) [2024-08-14T13:00:35.454Z] at PnP.Framework.Provisioning.ObjectHandlers.ObjectClientSidePages.CreatePage(Web web, ProvisioningTemplate template, TokenParser parser, PnPMonitoredScope scope, BaseClientSidePage clientSidePage, String pagesLibrary, List pagesLibraryList, Int32& currentPageIndex, List'1 preCreatedPages) [2024-08-14T13:00:35.457Z] at PnP.Framework.Provisioning.ObjectHandlers.ObjectClientSidePages.ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser, ProvisioningTemplateApplyingInformation applyingInformation) [2024-08-14T13:00:35.460Z] at PnP.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyRemoteTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation provisioningInfo, Boolean calledFromHierarchy, TokenParser tokenParser) [2024-08-14T13:00:35.462Z] at Microsoft.SharePoint.Client.WebExtensions.ApplyProvisioningTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation applyingInformation)

It would need to be fixed here:
https://github.com/pnp/pnpcore/blob/dev/src/sdk/PnP.Core/Model/SharePoint/Pages/Internal/Page.cs
Line: 2026
Probably add:
!PnPContext.Web.WebTemplate.Equals("GROUP", StringComparison.InvariantCultureIgnoreCase) &&

both packages have to be updated after as pnp.framework relates to pnp.core for pages

Message ID: MC791596
Roadmap ID: 386904

What actually changed is, that we have now a to section with a specific webPart for the Page-Title
<pnp:CanvasControl WebPartType="PageTitle"

@jansenbe

@jansenbe
Copy link
Contributor

@czullu : thanks for your PR in PnPCore! I'll test and merge this

@jansenbe
Copy link
Contributor

@czullu : thanks for the changes, they worked fine and I've merged them! These changes will be part of the next nightly, which I'll trigger manually so you have the updates within a few minutes

@nils-a , @cwparsons , @marcoschmucker , @Raven081189 : FYI

@till-llit
Copy link

@jansenbe : this problem is still active for different page layouts (vertical column, TwoColumnLeft) - can you re-open the issue?

@czullu : since you already resolved the issue related to OneColumn layouts and the new Header Section, do you have time to fix the other page layouts, too? That would be amazing.

@czullu
Copy link
Contributor

czullu commented Sep 25, 2024

@jansenbe : this problem is still active for different page layouts (vertical column, TwoColumnLeft) - can you re-open the issue?

@czullu : since you already resolved the issue related to OneColumn layouts and the new Header Section, do you have time to fix the other page layouts, too? That would be amazing.

Working on Fix - needs to done in pnp.core and pnp.framework.
Current Check:
if (sections.Any() && sections.First().Type == CanvasSectionTemplate.OneColumnFullWidth && sections.First().Controls.Any(c => (c as PageWebPart)?.WebPartId?.Equals("cbe7b0a9-3504-44dd-a3a3-0e5cacd07788") == true))
New Check
if (sections.Any(s=> s.Type == CanvasSectionTemplate.OneColumnFullWidth && s.Controls.Any(c => (c as PageWebPart)?.WebPartId?.Equals("cbe7b0a9-3504-44dd-a3a3-0e5cacd07788") == true)))

Gooing by assumption that we have new Header if we have any section of type "OneColumnFullWith" with the PageTitle-WebPart in it (not only the first section).

@nils-a
Copy link
Contributor Author

nils-a commented Oct 11, 2024

I'm a bit confused, currently. Should this be fixed?
I'm still getting errors when ex- and then importing a simple page in PnP.PowerShell version 2.99.9-nighly

@till-llit
Copy link

@nils-a : this is not yet completely fixed, there are several page layouts that still cause issues. see the open issue #1058 for reference

@Frau87
Copy link

Frau87 commented Nov 4, 2024

For anyone landing in this post in version 2.99.33-nightly seems fixed and is working correctly (need to use powershell 7 to install the version)

@till-llit
Copy link

@Frau87 : this is not correct - the issue is still reproducible for several page layouts (e.g.: OneColumn + VerticalSection) - just did the test with 2.99.34-nightly

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

8 participants