Skip to content

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

Closed
@JamesDerrickHH

Description

@JamesDerrickHH

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions