pnpcore icon indicating copy to clipboard operation
pnpcore copied to clipboard

Flexible Sections: Change a page title for a page that has flexible section disrupts the page structure

Open mohammadamer opened this issue 8 months ago • 1 comments

Category

  • [x] Feature request

Describe the feature

Flexible sections seem unsupported when using PnPCore in modern pages. Changing only the page title in a page with flexible sections disrupts the page structure.

I'm developing a custom translation solution for modern pages, which works well with regular pages. However, it fails with pages that have flexible sections.

My technical approach involves locating the text web parts in the page and translating them to the respective language. On pages with flexible sections, changing just the page title disrupts the page structure.

Describe the solution you'd like

Could you please let me know if the flexible sections are supported or can be controlled, and if there are any tips or tricks I should be aware of?

Additional context

 var page = pages.First();
 if (page != null)
 {
     page.PageTitle = PageControls.PageTitle;

     await page.SaveAsync();
     await page.PublishAsync();
 }

mohammadamer avatar Apr 07 '25 09:04 mohammadamer

Flex sections are not recognized, so they default to one column sections. Work is underway to support flexible sections: #1632

pschaeflein avatar Apr 07 '25 14:04 pschaeflein

Tested your case with the code in pull request https://github.com/pnp/pnpcore/pull/1670 and it worked for me

czullu avatar Jul 04 '25 19:07 czullu

Thanks for the fix @czullu , I just merged your PR!

@mohammadamer : FYI.

jansenbe avatar Aug 07 '25 11:08 jansenbe

Hey @jansenbe

I'm using PnP.Core 1.15.0 but unfortunately got the following errors: CanvasSectionTemplate' does not contain a definition for 'FlexibleLayoutVerticalSection

The name 'ZoneReflowStrategy' does not exist in the current context

in the following line, it looks like I'm using the wrong SDK version. Isn't it the latest version? newPage.AddSection(CanvasSectionTemplate.FlexibleLayoutVerticalSection, 1, zoneReflowStrategy: ZoneReflowStrategy.LeftToRight);

myproject.csproj <PackageReference Include="PnP.Core" Version="1.15.0" />

mohammadamer avatar Sep 24 '25 14:09 mohammadamer