powershell icon indicating copy to clipboard operation
powershell copied to clipboard

[BUG] Set-PnPPage - Using the Name parameter creates a new page

Open a1mery opened this issue 1 year ago • 0 comments

Reporting an Issue or Missing Feature

Issue when using Set-PnPPage with the -Name parameter.

Expected behavior

The execution of this cmdlet: Set-PnPPage -Identity "MyPage.aspx" -Name "MyModifiedPage" -Publish should set the Name of MyPage to MyModifiedPage.

Actual behavior

When running the cmdlet: Set-PnPPage -Identity "MyPage.aspx" -Name "MyModifiedPage" -Publish

I creates a new page with MyModifiedPage as Name. This new page is a copy of the original page with same Title.

Steps to reproduce behavior

Connect-PnPOnline -Interactive -Url "https://{tenant}.sharepoint.com/sites/MySite"
Add-PnPPage -Name "MyPage" -LayoutType Article -Publish
Set-PnPPage -Identity "MyPage.aspx" -Name "MyModifiedPage" -Publish

From what I could understand from here: IPage, the Name property is readonly. I would suggest to remove Name from the list of available parameters for this cmdlet as it does not allow to edit the name of an existing page and Identity is already there to identify the page to edit.

If that's sounds good, I could do this modification.

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

2.3.65

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

  • [x] Windows
  • [ ] Linux
  • [ ] MacOS
  • [ ] Azure Cloud Shell
  • [ ] Azure Functions
  • [ ] Other : please specify

a1mery avatar Feb 23 '24 22:02 a1mery