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? Commented Mar 29, 2018 at 14:57
  • Just validate the field names and values. Rest everything is fine Commented 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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.