Replies: 1 comment
-
What I can confirm in the meantime is that Add-PnPListItem with the -Batch parameter works as described in the documentation. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Issue
The example code from the help does not work as expected:
https://pnp.github.io/powershell/cmdlets/Set-PnPListItem.html?q=set-pnplistitem
When I execute this code not in batch mode but directly (If the -Batch parameter is removed from Set-PnPListItem, then it works, but very slowly, as it commits each item separately.)
Versions
PowerShell 7.2.1
PnP.PowerShell 1.9.0
Code
$values=@{}
$values["Territory"]="EMEA"
$batch = New-PnPBatch
for($i=0;$i -lt 5;$i++)
{
Set-PnPListItem -List "SalesList" -Identity $i -Values $values -Batch $batch
}
Invoke-PnPBatch -Batch $batch
Result
Set-PnPListItem:
Line |
4 | Set-PnPListItem -List "IO WW Backlog" -Identity $i -Values $value …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot find item with Identity PnP.PowerShell.Commands.Base.PipeBinds.ListItemPipeBind
Set-PnPListItem:
Line |
4 | Set-PnPListItem -List "IO WW Backlog" -Identity $i -Values $value …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Parameter count mismatch.
Set-PnPListItem:
Line |
4 | Set-PnPListItem -List "IO WW Backlog" -Identity $i -Values $value …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Parameter count mismatch.
Set-PnPListItem:
Line |
4 | Set-PnPListItem -List "IO WW Backlog" -Identity $i -Values $value …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Parameter count mismatch.
Set-PnPListItem:
Line |
4 | Set-PnPListItem -List "IO WW Backlog" -Identity $i -Values $value …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Parameter count mismatch.
Beta Was this translation helpful? Give feedback.
All reactions