Skip to content

Instantly share code, notes, and snippets.

@mirontoli

mirontoli/demote-news.ps1

Last active Feb 11, 2021
Embed
What would you like to do?
$site = "https://{tenant}.sharepoint.com/sites/{site}"
Connect-PnPOnline -Url $site -SPOManagementShell -ClearTokenCache
$field = "Promoted State"
$list = "Site Pages"
$id = 85 #the item id of the news
Set-PnPField -Identity $field -List $list -Values @{ReadOnlyField=$false}
#make sure to enclose the number into quotation marks
Set-PnPListItem -List $list -Identity $id -Values {"Promoted State"="0"}
#reset the field
Set-PnPField -Identity $field -List $list -Values @{ReadOnlyField=$true}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment