pnpcore icon indicating copy to clipboard operation
pnpcore copied to clipboard

Saving page causing duplicate page header

Open tom-daly opened this issue 1 year ago • 2 comments

Category

  • [x] Bug

Describe the bug

All I want to do is save a page. If the page header was removed it will add it back.

image

image

Steps to reproduce

I'm using PnP PowerShell 2.12.0 but the issue is in the .Save of the Page

  1. Get a page: $page = Get-PnPPage -Identity "My-Title.aspx"
  2. Save the page

Write-Host "Saving Page" $page.Save() $page.Publish("Content Updated by: $User") Write-Host "Saved Page"

Here I remove all the webparts + page header, add only 1 OOTB text editor, get the page, save then publish and the header will come right back. https://github.com/user-attachments/assets/1d3c986c-4eb5-4d1e-bd3d-a60b748f09e6

Even stranger behavior is if I empty the page, save + publish it - it will add the header back AND when you click edit the entire page is like the default home page.

https://github.com/user-attachments/assets/f21295ad-1ccf-4741-bedd-debe93262e0f

Expected behavior

I would expect the page header to be in the exact same status that it was before the .Save()

Environment details (development & target environment)

  • SDK version: PnP PowerShell 2.12.0 [the version that is tied with this]
  • OS: Windows 11
  • SDK used in: PowerShell 7.0 terminal
  • Framework: .NET Core
  • Browser(s): Chrome
  • Tooling: PowerShell 7.0
  • Additional details: using the latest stable PowerShell 2.12.0

Additional context

no additional details

Thanks for your contribution! Sharing is caring.

tom-daly avatar Oct 08 '24 16:10 tom-daly

Have you tried this in the nightly? Pages are (for me at least) very, very buggy since Rodmap feature 386904 has been active in the tenant.

nils-a avatar Oct 11 '24 09:10 nils-a

I just tried the PnP.PowerShell nightly 2.12.23-nightly. It still puts the header back on if it was previously removed. I'm not sure how to tell what version of PnP.Core is in PnP.PowerShell

tom-daly avatar Oct 12 '24 01:10 tom-daly

@tom-daly : I could reproduce your issue...it's related to the new page header model that SharePoint introduced

jansenbe avatar Nov 18 '24 09:11 jansenbe

@tom-daly : I've just pushed a fix for this issue, it should appear in the next nightly build of Core SDK and then it will also end up in the next nightly build for PnP PowerShell. I'm closing the issue now, but please re-open a create a new one if the problem is still not solved from your end.

jansenbe avatar Nov 18 '24 10:11 jansenbe

I just want to say thank you for fixing this!! highly appreciated

tom-daly avatar Nov 26 '24 20:11 tom-daly