Pnp to reterive all pages
Connect-PnPOnline -Url "https://yourtenant.sharepoint.com/sites/YourSite" -Credentials (Get-Credential)
# Get the site pages library
$sitePagesLibrary = Get-PnPList -Identity "Site Pages"
# Query for pages where "isincludeinnews" is "yes"
$pagesToUpdate = Get-PnPListItem -List $sitePagesLibrary -Query "<View><Query><Where><Eq><FieldRef Name='isincludeinnews' /><Value Type='Boolean'>1</Value></Eq></Where></Query></View>"
# Update the specific column for each page
foreach ($page in $pagesToUpdate) {
# Set the value of the target column (e.g., "YourTargetColumn")
$page["YourTargetColumn"] = $false # Set to false to match your condition
$page.Update()
}
# Execute the changes
Invoke-PnPQuery
Comments
Post a Comment