PnP JS delete list item

Remove-PnPListItem

  • Reference
Is this page helpful?

Please rate your experience

Yes No
Any additional feedback?

Feedback will be sent to Microsoft: By pressing the submit button, your feedback will be used to improve Microsoft products and services. Privacy policy.

Submit

Thank you.

Module: PnP.Powershell Applies to: SharePoint Online

Tip

We encourage you to make improvements to this documentation. Please navigate to //github.com/pnp/powershell/blob/dev/documentation/Remove-PnPListItem.md to change this file.

Deletes an item from a list

In this article

Syntax

Remove-PnPListItem [-List] <ListPipeBind> -Identity <ListItemPipeBind> [-Recycle] [-Force] Remove-PnPListItem [-List] <ListPipeBind> -Identity <ListItemPipeBind> -Batch <PnPBatch> [-Recycle]

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 "Demlo List" list after asking for confirmation

Parameters

-Batch

Batch object used to add items in a batched manner. See examples on how to use this.

Type:PnPBatch
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-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
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
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
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-List

The ID, Title or Url of the list

Type:ListPipeBind
Position:0
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-Recycle

When provided, items will be sent to the recycle bin. When omitted, items will permanently be deleted.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Related Links

  • Microsoft 365 Patterns and Practices

Video liên quan

Chủ đề