Search Results for

    Show / Hide Table of Contents

    New-PnPBatch

    SYNOPSIS

    Creates a new batch

    Supports Batching

    SYNTAX

    New-PnPBatch [-RetainRequests]
    

    DESCRIPTION

    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.

    EXAMPLES

    EXAMPLE 1

    $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.

    EXAMPLE 2

    $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.

    PARAMETERS

    -RetainRequests

    Type: SwitchParameter
    Parameter Sets: (All)
    
    Required: True
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    RELATED LINKS

    Microsoft 365 Patterns and Practices

    Back to top Generated by DocFX spacer