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

[BUG] Add-PnPPageSection fails when a full-width section with non-banner webpart is on the page #4471

Open
1 task done
JamesDerrickHH opened this issue Oct 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@JamesDerrickHH
Copy link

JamesDerrickHH commented Oct 23, 2024

Reporting an Issue or Missing Feature

When I try to use the Add-PnPPageSection cmdlet to add a webpart to a news item page, if there is a full-width section with any webpart, other than a banner, already on the page then I get an error

Expected behavior

I expect the cmdlet to add a new section to the news item page

Actual behavior

I receive the following error and the section is not added
You cannot host text controls inside a one column full width section, only an image web part or hero web part are allowed

Steps to reproduce behavior

Create a news item page with multiple sections
Make one of the sections a Full-Width section, with an image webpart
Try to run the Add-PnPPageSection cmdlet for that page

The script I have involves finding any file created in the last day
$Files = $Files | Where-Object { $_.TimeCreated -gt (Get-Date).AddDays(-1) }
Then cycling through them, working out if the page has a specific webpart in it already
If it doesn't then add a new section, and add the webpart to that section
This is the command I am trying to run
Add-PnPPageSection -Page $Page -SectionTemplate OneColumn -ZoneEmphasis 2 -Order ($Page.Sections.Count + 1)
In essence finding out how many sections the page currently has and adding a new one
But it gives me the error mentioned previously, which is confusing as I am not trying to add text controls to a full width section, but just add a new section entirely.

What is the version of the Cmdlet module you are running?

PnP.Powershell 2.12

Which operating system/environment are you running PnP PowerShell on?

  • Windows
@JamesDerrickHH JamesDerrickHH added the bug Something isn't working label Oct 23, 2024
@JamesDerrickHH JamesDerrickHH changed the title [BUG] Add-PnPPageSection fails when a full-width section is on the page [BUG] Add-PnPPageSection fails when a full-width section with image webpart is on the page Oct 23, 2024
@JamesDerrickHH JamesDerrickHH changed the title [BUG] Add-PnPPageSection fails when a full-width section with image webpart is on the page [BUG] Add-PnPPageSection fails when a full-width section with non-banner webpart is on the page Oct 23, 2024
@jackpoz
Copy link
Contributor

jackpoz commented Oct 24, 2024

This is the same issue as #4382 and has been reported to PnP Core at pnp/pnpcore#1554 .

It might help to post a comment on PnP Core to say that it affects you too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants