Updating SharePoint List Items using PnP-PowerShell
$SiteURL="https://saiprasadp.sharepoint.com/sites/TestClassic"
$ListName= "Test List"
$SPQuery = "<View><Query><Where><Eq><FieldRef Name='Urgency'/><Value Type='text'>High2</Value></Eq></Where></Query></View>"
#Connect to PNP Online
Connect-PnPOnline -Url $SiteURL -UseWeblogin
#sharepoint online pnp powershell get list items
$ListItems = Get-PnPListItem -List $ListName -Query $SPQuery
#Update items in batch
$batch = New-PnPBatch
foreach($ListItem in $ListItems)
{
Write-Host "ID:" $ListItem["ID"]
Set-PnPListItem -List $ListName -Identity $ListItem["ID"] -Values @{"Title"="Updated Title1"} -UpdateType UpdateOverwriteVersion -Batch $batch
}
Invoke-PnPBatch -Batch $batch
Comments
Post a Comment