0

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.

1 Answer 1

0

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"}  
} 
2
  • Is this the complete script or do I need to update anything in this?
    – Brishal
    Mar 29, 2018 at 14:57
  • Just validate the field names and values. Rest everything is fine
    – Deepmala
    Apr 2, 2018 at 3:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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