Collapsible sections with webparts in ClientSidePages are not provisioned correctly
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 259
- Forks
- 161
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 1
Description
Category
- Bug
Describe the bug
When extracting a ClientSidePage to provision on a different SharePoint site, the resulting ClientSidePage is different from the extracted one. Here is an image of the page I'm extracting:

And here is an image after the extracted page is provisioned on a different SharePoint site:

Problems:
The section containing a webpart is not collapsible.
The vertical section gets the same collapsible settings as the top section.
Steps to reproduce
- Create a client side page with a vertical section, and a collapsible section containing a webpart
- Extract the ClientSidePage provisioning template using
PnP.Framework ClientSidePageContentsHelper.ExtractClientSidePage(); - Apply the extracted provisioning template to a different sharepoint site.
Expected behavior
I am expecting the provisioned ClientSidePage to look the same as the extracted one. (See images above)
Environment details (development & target environment)
- SDK version: 1.8
- OS: Windows 10
- SDK used in: ASP.Net Web App
- Framework: .Net Framework 4.8
- Browser(s): Chrome v109
- Tooling: Visual Studio 2019
Additional context
I think the problem might be located in PageWebPart.cs. Here's a snippet of the code responsible for setting the section collapsible. Note that setting the Type = 1 renders the section as collapsible, as expected.
controlData.ZoneGroupMetadata = new SectionZoneGroupMetadata()
{
// Set section type to 1 if it was not set (when new sections are added via code)
Type = (Section as CanvasSection).SectionType,
DisplayName = Section.DisplayName,
IsExpanded = Section.IsExpanded,
ShowDividerLine = Section.ShowDividerLine,
};
In PageText.cs that same snippet of code reads like this. I suspect maybe the PageWebPart.cs code should be the same.
controlData.ZoneGroupMetadata = new SectionZoneGroupMetadata()
{
// Set section type to 1 if it was not set (when new sections are added via code)
Type = (Section as CanvasSection).SectionType == 0 ? 1 : (Section as CanvasSection).SectionType,
DisplayName = Section.DisplayName,
IsExpanded = Section.IsExpanded,
ShowDividerLine = Section.ShowDividerLine,
};
As for the issue with the vertical section taking the same collapsible settings as the first section, I think it should just not be possible to mark a vertical section as collapsible, since it's not possible in the editor. Checking if the section is a vertical section before setting ZoneGroupMetadata.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ClientSidePageContentsHelper.ExtractClientSidePage(), then compare the ZoneGroupMetadata handling in PageWebPart.cs and PageText.cs. Reproduce extraction and provisioning with a vertical section and a collapsible section containing a webpart; done means the provisioned page preserves collapsibility while the vertical section does not inherit those settings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100