Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete all items from list?

Tags:

sharepoint

How can I delete all items from a list in Sharepoint?

I have to delete my list and create it again... Can anyone help me with this problem?

like image 723
Lugarini Avatar asked Jul 23 '14 17:07

Lugarini


4 Answers

if you have list with more than 500 items, and you don't want to chose coding path, and don't want to delete list as well, than you go to "Manage Content and Structure" view, it allows you to view 1000 items at once and than select all delete all.

like image 146
Nikunj Avatar answered Sep 27 '22 15:09

Nikunj


You can delete all items at once in a Datasheet view (Ctrl+A > right click on the row > delete row).

like image 27
Mart Potter Avatar answered Sep 27 '22 15:09

Mart Potter


You can connect Microsoft Access to SharePoint and run SQL commands to delete all records or use WHERE conditions. More Information at: http://office.microsoft.com/en-ca/access-help/import-from-or-link-data-to-a-sharepoint-list-HA102749600.aspx.

like image 21
jpussacq Avatar answered Sep 27 '22 16:09

jpussacq


Besides the suggestions before and if you have access to Power Automate you can create a flow which deletes all items of your list.

Your flow will look something like this: MS Flow: Delete all items of a SP list

  1. There is a manual trigger
  2. Get all items of your SP list
  3. Set the variable COUNT_OF_LIST to the length(outputs('Get_items_Items_of_list')?['body/value']) => The count of items in the list
  4. Do until COUNT_OF_LIST is equal to 0 enter image description here
  5. Get all items you want to delete of your list
  6. Apply to each of these items and delete it with the Delete Item action
  7. Get all items of the list again
  8. Set COUNT_OF_LIST to length(outputs('Get_items_Inner')?['body/value']) => The count of still leftover items

Since a normal Get Items action will only give you 100 items you need to set the Top Count in the advanced options to 4999 (https://alextofan.com/2019/08/22/how-to-get-more-than-5000-item-from-sharepoint-online-in-flow/#:~:text=5000%20items%20limit&text=The%20maximum%20top%20count%20you,than%20100%20items%20are%20retrieved.)

This flow can be optimized, as it has a lot of Get Items actions. But for now this should do the trick.

like image 36
TerenceJackson Avatar answered Sep 27 '22 15:09

TerenceJackson