M365 Dev Blog

Delete all SharePoint list items with PowerShell

delete items

Did you ever wanted to quickly delete all items from a SharePoint list without having to run into complex scenarios?
This can be simply achieved using PnP Powershell (obviously!). And it fits in a single line!

If you are looking for options to delete documents from SharePoint document libraries, maybe this post can help.

Delete SharePoint list items

Connect to the site using Connect-PnPOnline and then run:

Get-PnPList -Identity Lists/MyList | Get-PnPListItem -PageSize 100 -ScriptBlock { Param($items) 
$items.Context.ExecuteQuery() } | % {$_.DeleteObject()}

Exit mobile version