Delete all items in a SharePoint list with PowerShell

Disclaimer: There are several ways to do this – if you don’t need the list, just delete the whole list.

If you need the structure of the list and just need to delete the items in the list, this script will do it, but there are faster methods out there so if you have 1000’s of items, know that this approach is kinda slow.

You might think (As I did) that once you had the list you could do something clever like:

$list.items.delete() #this fails

You might also wonder why we getitembyID.  You might wonder why we don’t just put $item.delete() inside the foreach loop – that fails too, so we get around that with the last line which seems to work, albeit slowly…

5 thoughts on “Delete all items in a SharePoint list with PowerShell

      1. You are right in general, however, if there is anything wrong with the XML structure or its content, you get Native Stack error where you can’t understand what went wrong and how to fix it…

  1. Just FYI to anyone who’s running across this article in the future, I had issues using the SharePoint CSOMs(using O365 SharePoint), with the .delete() method. Powershell claimed the method didn’t exist.

    More research led me to this article here: https://msdn.microsoft.com/en-us/library/office/gg701783(v=office.14).aspx

    This used .deleteobject() instead of .delete in the same general context as above with C#. .Deleteobject() worked for me.

Leave a Reply