Set-PnPListItem command not working in batch.

Copper Contributor

I am trying to perform an update of a document library value with the Set-PnPListItem command.
-batch parameter is not working properly, what is the solution?

When Using -batch parameter, Must Identity parameter be ID not GUID?

Working:

$ListItems = Get-PnPListItem -List $List -PageSize 2000
$ListItem = $ListItems | where { $_["GUID"] -eq xxxx-xxxx-xxxx-xxxx }
Set-PnPListItem -List $config.Config.LibraryName -Identity $ListItem -Values $ItemValue

Not woking:

$ListItems = Get-PnPListItem -List $List -PageSize 2000
$ListItem = $ListItems | where { $_["GUID"] -eq xxxx-xxxx-xxxx-xxxx }
Set-PnPListItem -List $config.Config.LibraryName -Identity $ListItem -Values $ItemValue -Batch $batch

Error:

Set-PnPListItem : Cannot find item with Identity PnP.PowerShell.Commands.Base.PipeBinds.ListItemPipeBind
発生場所 C:\Work\property_update.ps1:235 文字:9
+         Set-PnPListItem -List $config.Config.LibraryName -Identity $L ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Set-PnPListItem], PSArgumentException
    + FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.Lists.SetListItem

The $ListItem definitely has the item registered.
I specified $ListItem.Id as a test, but the error occurred.
I get an error like Length cannot be less than 0.

Not woking:

$ListItems = Get-PnPListItem -List $List -PageSize 2000
$ListItem = $ListItems | where { $_["GUID"] -eq xxxx-xxxx-xxxx-xxxx }
Set-PnPListItem -List $config.Config.LibraryName -Identity $ListItem.id -Values $ItemValue -Batch $batch

More information:.
The character encoding of the .ps1 file is UTF-8 with BOM.
The OS language is Japanese.

 

1 Reply