Delete all items in SharePoint List using PowerShell




While testing SharePoint solution with SPLists I often need empty list. I'd like to have analog for "Truncate" in SQL, but there's nothing for SharePoint.

So I wrote a short PowerShell script for deleting all items in SharePoint List. Here it is

 

Using C# deleting like this - it must be from last to first element (Correct way to delete all SPListItems)




2 Comments »

  1. […] however the current script does not do this. I may just delete the list before import each time. Here is another PowerShell script to delete all items in a list, be careful to select the correct […]

    Pingback by More SharePoint 2013 Setup Tidbits | Crashcarr — March 10, 2014 @ 10:26 pm

  2. However I haven’t found a working script on your site 🙂
    But I see you’re my colleague in work with SharePoint

    Comment by admin — March 13, 2014 @ 2:16 am

RSS feed for comments on this post. TrackBack URL

Leave a comment





MarkiMarta.com. Notes of web-specialist
Since 2009
18+