pnp / powershell

PnP PowerShell
https://pnp.github.io/powershell
MIT License
674 stars 347 forks source link

[BUG]Set-PnpListItem with Batch Set not working as expected #3544

Open SP-Support opened 11 months ago

SP-Support commented 11 months ago
$pnpBatch = New-PnPBatch -Connection $conn;
ForEach($item in $listItems){

        $values = @{"internalField"="UNKNOWN"}
        Set-PnPListItem -List $list -Identity $item.Id -Values $values -Connection $conn -UpdateType SystemUpdate -Batch $pnpBatch

}
Invoke-PnPBatch -Batch $pnpBatch -Connection $conn

Reporting an Issue or Missing Feature

If the interalField is a multiselect choice column the above code changing the string "UNKNOWN" into an array and posts an array of values instead of the actual string.

Expected behavior

The internalField should receive the value of "UNKNOWN" image

Actual behavior

Please describe what you see instead. Please provide samples of output or screenshots. image

Steps to reproduce behavior

See the code snippet above to reproduce.

What is the version of the Cmdlet module you are running?

2.2.0

Which operating system/environment are you running PnP PowerShell on?

AndersRask commented 11 months ago

I tried this using 2.2.23 nightly and could not reproduce. EDIT: i tried with an "allow multiple selections" version of choice field, and can reproduce: It works with Set-PnPListItem -List test -Identity 1 -Values @{someField2="UNKNOWN"} but using batch it seems like it splits the value into multiple values "U","N" etc $items | % { Set-PnPListItem -List test -Identity $_.Id -Values @{someField2="UNKNOWN"} -UpdateType SystemUpdate -Batch $pnpBatch } image