Module Name | title | schema | applicable | external help file | online version |
---|---|---|---|---|---|
PnP.PowerShell |
New-PnPBatch |
2.0.0 |
SharePoint Online |
PnP.PowerShell.dll-Help.xml |
Creates a new batch
New-PnPBatch [-RetainRequests]
Creates a new batch to be used by cmdlets that support batching. The requests in the batch are clear after execute Invoke-PnPBatch, unless you specify -RetainRequests. That allows you to execute batch multiple times.
$batch = New-PnPBatch
Add-PnPListItem -List "DemoList" -Values @{"Title"="Demo Item 1"} -Batch $batch
Add-PnPListItem -List "DemoList" -Values @{"Title"="Demo Item 2"} -Batch $batch
Add-PnPListItem -List "DemoList" -Values @{"Title"="Demo Item 3"} -Batch $batch
Invoke-PnPBatch -Batch $batch
This will add the 3 defined list items in the batch.
$batch = New-PnPBatch
1..50 | Foreach-Object{Remove-PnPListItem -List "DemoList" -Identity $_ -Batch $batch}
Invoke-PnPBatch -Batch $batch
This will delete all the items with Id 1 to Id 50 in the specified list.
Type: SwitchParameter
Parameter Sets: (All)
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False