I have a document library with name Project and it has 5000 records. I have one field business(choice field). I want to run powershell csom on this particular document library and update the value of business field from IBG to IBL where ever it has.

This is o365 so need powershell csom. Can someone provide me script please.


Use below:

$siteurl = "SiteURL"  
Connect-SPOnline -Url $siteurl  
$ctx = Get-SPOContext
$listItems = Get-SPOListItem -List PnPList -Query "<View><Query><Where><Eq><FieldRef Name='BusinessField'/><Value Type='Text'>IBG</Value></Eq></Where></Query></View>"
foreach($item in $listItems)
    Set-SPOListItem -List "PnPList" -Identity $item -Values @{"BusinessField"="IBL";"ProductId"="6"}  
  • Is this the complete script or do I need to update anything in this? – Brishal Mar 29 '18 at 14:57
  • Just validate the field names and values. Rest everything is fine – Deepmala Apr 2 '18 at 3:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.