Forum Discussion
Tamras1972
Feb 06, 2023Iron Contributor
Change Promoted State value
In Site Pages library, I need to change News (Promoted State =2) to Page (Promoted State = 0) -- however, the Promoted State column is read only. Is there another way to change the page from News to...
- Feb 06, 2023The Promoted State column in the Site Pages library is read-only and it is designed to be set by the system. It is not recommended to manually change the value of the Promoted State column, as this could have unintended consequences.
There is no built-in way to change the Promoted State value without using Power Automate or PowerShell. You could use Power Automate to automate the change of the Promoted State value, or use PowerShell to update the value programmatically.
If you do not want to use Power Automate or PowerShell, you could consider creating a new page and copying the content from the News page to the new page. You can then delete the News page if needed.
Adnan_Amin
Feb 06, 2023MVP
The Promoted State column in the Site Pages library is read-only and it is designed to be set by the system. It is not recommended to manually change the value of the Promoted State column, as this could have unintended consequences.
There is no built-in way to change the Promoted State value without using Power Automate or PowerShell. You could use Power Automate to automate the change of the Promoted State value, or use PowerShell to update the value programmatically.
If you do not want to use Power Automate or PowerShell, you could consider creating a new page and copying the content from the News page to the new page. You can then delete the News page if needed.
There is no built-in way to change the Promoted State value without using Power Automate or PowerShell. You could use Power Automate to automate the change of the Promoted State value, or use PowerShell to update the value programmatically.
If you do not want to use Power Automate or PowerShell, you could consider creating a new page and copying the content from the News page to the new page. You can then delete the News page if needed.
- SturbergMay 07, 2024Copper Contributor
My answer comes late, but I was able to edit this column with the quick edit function.
- Tamras1972Feb 06, 2023Iron ContributorThanks for confirming it. I was hoping there are new developments and/and or easier way to do this since most of the answers I found online where few years old.
- Adnan_AminFeb 06, 2023MVPBelow is PowerShell script which require PnP PowerShell module to change the Promoted State of a page in the Site Pages library:
$pageName = "YourPageName.aspx"
$file = Get-PnPFile -Url "/SitePages/$pageName"
$pageItem = Get-PnPListItem -List "Site Pages" -Id $file.ListItemAllFields.Id
$pageItem["PromotedState"] = 0
$pageItem.Update()
Invoke-PnPQuery- CLHessApr 17, 2023Copper ContributorLine # 3 gives me an error that I don't know how to resolve (I am new to PNP). I get this error
Get-PnPListItem : Cannot bind parameter 'Id' to the target. Exception setting "Id": "Cannot convert null to type
"System.Int32"."
At line:1 char:49
+ ... eItem=Get-pnpListItem -List "Site Pags" -ID $file.ListItemAllField.id
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Get-PnPListItem], ParameterBindingException
+ FullyQualifiedErrorId : ParameterBindingFailed,PnP.PowerShell.Commands.Lists.GetListItem- nicklee88May 03, 2023Copper Contributor
CLHess That's correct, the $file object in the original post doesn't carry the Id of the page so it's passing null to the Get-PnpListItem cmdlet.
Assuming you know the name of the page you're wanting to unpublish, you'd be able to retrieve it with the code below without the need for the page Id.
# Get the desired page object $PostName = "Some Post" $Page = Get-PnPListItem -List "Site Pages" | Where-Object {$_.FieldValues.Title -eq $PostName} # Change promoted state and update $Page["PromotedState"] = 0 $Page.UpdateItem() Invoke-PnPQuery