Skip to content

[BUG] Set-PnPPageTextPart returns You cannot host text controls inside a one column full width section ... #4719

Description

@Mesicni

Reporting an Issue or Missing Feature

Set-PnPPageTextPart returns error You cannot host text controls inside a one column full width section, only an image web part or hero web part are allowed after Microsoft pushed updates to Page layout options.

Expected behavior

Change text webpart text. The issue is probably related to the recent Microsoft updates to top page section, which now allows fullwidth section with webparts instead of only banner or hero.
Related to

Actual behavior

Error: Set-PnPPageTextPart : You cannot host text controls inside a one column full width section, only an image web part or hero web part are allowed
At line:32 char:17

Steps to reproduce behavior

#variables
$siteUrl = "xxx"
$oldText = "abc"
$newText = "def"

#script

Connect-PnPOnline uuu -clientID yyy
 
# Get all pages from the Site Pages library
$pages = Get-PnPListItem -List "Site Pages"
 
foreach ($pageItem in $pages) {
    # Get the file name of the page
    $pageName = $pageItem.FieldValues["FileLeafRef"]
    Write-Host "Processing page: $pageName" -ForegroundColor Yellow
 
    # Load the page
    $page = Get-PnPClientSidePage -Identity $pageName
 
    if ($page) {
        foreach ($webPart in $page.Controls) {
            if ($webPart.Type.Name -eq "PageText") {
                $textContent = $webPart.Properties["Text"]

                # Replace old text with new text
                $updatedTextContent = $textContent -replace [regex]::Escape($oldText), $newText
 
                # Update the text part
                #Set-PnPPageTextPart -Page $pageName -Text $updatedTextContent -InstanceId $webPart.InstanceId
                # $instanceIdString = $webPart.InstanceId.ToString()
                #Write-Host "Text webpart $instanceIdString.InstanceId updated successfully for page $pageName." -ForegroundColor Green
            }
        }
    } else {
        Write-Host "Page not found or could not be loaded: $pageName" -ForegroundColor Red
    }
}

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

1.12.0

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

  • [ x] Windows

Activity

  1. Raven081189 commented on Feb 21, 2025

    @Raven081189

    Do you know when this bug will be fixed?

  2. gautamdsheth commented on May 24, 2025

    @gautamdsheth
    Collaborator

    Hello, can you please try out the latest nightly builds and let us know ? There has been quite a few improvements in this area , hopefully helps with your issue.

  3. JoelBool commented on Aug 25, 2025

    @JoelBool

    We see this issue in version 3.1.0 as well.

    I get issues when trying to add new sections with Add-PnPPageSection
    I also get the issue when trying to add text web part with Add-PnPPageTextPart to non full width sections

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

  4. reshmee011 commented on Apr 16, 2026

    @reshmee011
    Collaborator

    I could reproduce the issue with Add-PnPPageTextPart, Add-PnPPageWebPart not with Add-PnPPageSection.

    There is a similar issue from pnp/pnpcore#387 and the fix is to add a property "isFullWidth" somehow. I will check if it's possible.

  5. bcameron1231 commented on Jul 10, 2026

    @bcameron1231

    I am also seeing this issue in our environments however with other webparts and using Set-PnPPageWebPart. Setting isFullWidth doesn't solve the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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