Remove-PnPListItem
SYNOPSIS
Deletes an item from a list
SYNTAX
Single
Remove-PnPListItem [-List] <ListPipeBind> -Identity <ListItemPipeBind> [-Recycle] [-Force]
Batched
Remove-PnPListItem [-List] <ListPipeBind> -Identity <ListItemPipeBind> -Batch <PnPBatch> [-Recycle]
DESCRIPTION
Allows to remove a list item.
EXAMPLES
EXAMPLE 1
Remove-PnPListItem -List "Demo List" -Identity "1" -Force
Removes the listitem with id "1" from the "Demo List" list
EXAMPLE 2
Remove-PnPListItem -List "Demo List" -Identity "1" -Force -Recycle
Removes the listitem with id "1" from the "Demo List" list and saves it in the Recycle Bin
EXAMPLE 3
$batch = New-PnPBatch
1..50 | Foreach-Object{Remove-PnPListItem -List "DemoList" -Identity $_ -Batch $batch}
Invoke-PnPBatch -Batch $batch
Removes all the items with Id 1 to Id 50 in the "Demo List" list
EXAMPLE 4
Remove-PnPListItem -List "Demo List"
Removes all items from the "Demo List" list after asking for confirmation
PARAMETERS
-Connection
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.
Type: PnPConnection
Parameter Sets: (All)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Force
Specifying the Force parameter will skip the confirmation question
Type: SwitchParameter
Parameter Sets: (All)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Identity
The ID of the listitem, or actual ListItem object
Type: ListItemPipeBind
Parameter Sets: (All)
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-List
The ID, Title or Url of the list
Type: ListPipeBind
Parameter Sets: (All)
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-Recycle
When provided, items will be sent to the recycle bin. When omitted, items will permanently be deleted.
Type: SwitchParameter
Parameter Sets: (All)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Batch
Batch object used to add items in a batched manner. See examples on how to use this.
Type: PnPBatch
Parameter Sets: Batched
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False