0

i have powershell script of PNP for setting list item value using for loop.

$ListItems_Values=(Get-PnPListItem -List fretag%20vrigt -Fields "FileLeafRef").FieldValues

foreach ($item in $ListItems_Values){ if($item.FileLeafRef -match "Ö") { $item.FileLeafRef=$item.FileLeafRef -replace "Ö","O"

Set-PnPListItem -List fretag%20vrigt -Identity $item.FileLeafRef -Values @{"FileLeafRef" = $item.FileLeafRef} -SystemUpdate:$True

Write-Host $item.FileLeafRef "O is replace" }

else{Write-Host $item.FileLeafRef "O is missing"} }

it fetching value of FileLeafReaf column but when i set using set_pnplist item it throws below error enter image description here

0

it is solved.Used $item.ID for set item. It only accept Title,ID and GUID column with identity parameter. foreach ($item in $ListItems_Values){if($item.FileLeafRef -match "Ö"){

$item.FileLeafRefvalue=$item.FileLeafRef -replace "Ö","O"

Set-PnPListItem -List "fretag%20vrigt" -Identity $item.ID -Values @{"FileLeafRef" = $item.FileLeafRefvalue} -SystemUpdate:$True Write-Host $item.FileLeafRefvalue "O is replace" }

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.