Skip to content

Instantly share code, notes, and snippets.

@mirontoli
Last active February 11, 2021 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mirontoli/a1a68a99a882c458ab0bdadd5dc79a90 to your computer and use it in GitHub Desktop.
Save mirontoli/a1a68a99a882c458ab0bdadd5dc79a90 to your computer and use it in GitHub Desktop.
$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