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

Popular posts from this blog

Power Apps June 2023 Updates (Canvas App Focused)

Effortlessly Import JSON Data into SharePoint with Power Automate Flow: A Step-by-Step Guide

Unleash the Power of Power Apps: Retrieve Over 2000 Records from a SharePoint List Effortlessly Without Delegates