How to Delete All Items in a SharePoint List with Power Automate

Do you want to delete all the items in your SharePoint list using Power Automate?

SharePoint lists are a great tool for storing and tracking things such as tasks, clients, contacts, or other important business data. They are very flexible and can be accessed from anywhere to support real-time collaboration.

There are many reasons why you might need to delete all the items in your SharePoint list. Perhaps the data is no longer relevant, maybe it is only a test list with test data, or you want to start fresh with new information.

Whatever the case. this can be done easily with Power Automate. For example, you can set up a flow to remove all the items from your SharePoint list on a monthly schedule.

This post will show you how to set up a flow to delete all the items in your list.

Set the Trigger

Deleting all the items in your list could be a small part of a bigger flow initiated by just any trigger.

This example will set up a flow to delete the items based on a schedule that runs each month.

  1. Go to the Create menu.
  2. Select Scheduled cloud flow.
  3. Enter a Flow name in the Build a scheduled cloud flow menu.
  4. Set the Starting date and time. This will be the same date and time each month.
  5. Set Repeat every field to 1 and Month.
  6. Press the Create button

This will create a new flow that is scheduled to run once a month and you will be able to add the actions needed to delete your SharePoint items.

Get All Items from the SharePoint List

In order to delete all the items in your SharePoint list, you will first need to list them all.

This will get you an array of item IDs which can then be used to delete the items.

  1. Add the Get items action from the SharePoint connector to your flow.
  2. Select the Site Address that contains the list.
  3. Select the List Name of the items to be deleted.

You will want to list the maximum number of items possible since the goal is to delete all the items. Unfortunately, this action can return at most 5,000 of your list items at a time.

The default number of items returned is set to 100, so you will need to adjust this to the 5,000 maximum.

  1. Click on the Ellipse icon in the top right of the Get items action.
  2. Select the Settings option.
  1. Turn on Pagination and set the Threshold to 5000.
  2. Press the Done button at the bottom of the settings.

Now you will be able to get 5000 items in each flow run.

Delete Items from the SharePoint List

Now you can add the action to the flow to delete the items from the Get items action.

  1. Add the Delete item action from the SharePoint connector.
  2. Set the Site Address to the same as the Get items action.
  3. Set the List Name to the same as the Get items action.
  4. Add the ID dynamic content from the Get items action to the Id field of the Delete item action.

📝 Note: This will automatically add an Apply to each action to the flow which will allow the flow to loop through all the items in the list and delete them.

Add Concurrency to Speed Up the Flow

The Apply to each action will only delete one item from your list at a time.

This can mean the flow will take a long time to run if you have a lot of items on the list. But there is a way to speed up the flow quite considerably.

  1. Click on the Ellipse icon in the Apply to each action.
  2. Go to the Settings option.
  1. Turn on the Concurrency Control.
  2. Set the Degree of Parallelism to the maximum value of 50.
  3. Click on the Done button.

Now the flow will delete items from the SharePoint list in batches of 50 items. This should speed up the total run time of the flow!

Conclusions

SharePoint lists are a great tool and they are even better when used with the automation available in Microsoft Power Automate.

Deleting items in a list could be a tedious task if you need to repeat this every month. But Power Automate can do all the work for you with a small bit of setup.

Have you ever needed to delete all the items in your SharePoint list? Did you use a Power Automate flow to get it done? Let me know in the comments!

About the Author

John MacDougall

John MacDougall

John is a Microsoft MVP and freelance consultant and trainer specializing in Excel, Power BI, Power Automate, Power Apps and SharePoint. You can find other interesting articles from John on his blog or YouTube channel.

Related Articles

Comments

2 Comments

  1. Jairam

    Yes, I have got this use case to delete the records having more than 4K records.

    As you mentioned, it’s a very tedious job to delete the records either manually or via Power automate.

    Even with the concurrency set to 50, deleting 4K records is very time consuming.

    Other way around would be to delete the list altogether ( if you are deleting the whole set of records from the list) and recreate it. Here, atleast we are saving the time consumed by the delete operation.

    Is there any other work around?

    • John MacDougall

      Yes, creating a new list is another option.

Get the Latest Tech Tips

Write For Us

Are you a tech enthusiast with a talent for writing great content? Come write for us!

Follow Us

Follow us on social media to stay up to date with the latest in tech!