Do you need to quickly delete all items from your SharePoint list using Power Automate? In this tutorial, we will see how to delete all items from a SharePoint list using Power Automate.
Also, we will see how to delete all items from the SharePoint list based on date using Power Automate. Then, we will see how to delete SharePoint list items older than 7 days in Power Automate.
As there are many reasons why we need to delete all items from the SharePoint list like the list is a test list and you don’t need it anymore, or the data is no longer required/relevant or you want to start with fresh data.
Whatever the reason will be, we can delete all items from a SharePoint list easily and quickly using Power Automate.
Now, let’s create a flow that will quickly delete all items from the SharePoint list in Power Automate
Delete all items from a SharePoint list using Power Automate
Here, we will see how to delete all items from the SharePoint list using Power Automate.
For example, I have a list, i.e., Product in SharePoint, and I need to delete items from this SharePoint list. This list contains 2 columns Title and price, which you can see in the below screenshot.
Let’s create the flow in Power Automate that will delete all SharePoint list items.
1. Open Power Automate Cloud, then click on the + Create icon -> select Instant Cloud flow.
2. Then provide the flow name, select Manually trigger a flow action, and then click on Create.
You can see that Manually triggered flow action is added to the flow page.
3. Now, we will get all items from the SharePoint list using Power Automate. For this, click on +New steps -> select Get Items action. Then provide the below information:
- Site address: Provide the SharePoint site address
- List name: Select the list from the dropdown.
4. Now, we will delete all items from the SharePoint list; for this, click on the +New step -> select Delete item action. Then provide the below information:
- Site address: Provide the SharePoint site address
- List name: Select the list from the dropdown.
- Id: Select the id from the dynamic content. This will automatically add Apply to each action to the flow as we are working on multiple items.
5. Now run the flow manually; you can see all items are deleted from the SharePoint list using Power Automate.
This is how to delete all items from the SharePoint list using Power Automate.
Delete items from the SharePoint list based on date using Power Automate
Here, we will see how to delete all items from the SharePoint list based on date using Power Automate.
For example, we have a list of events in SharePoint list called “Events,’ and we need to delete events that will happen on 10-12-2023. For this, I have created an Instant cloud flow that will take the date as an input and trigger manually and then get the items from the SharePoint list based on the input date and delete all items from the SharePoint list.
The Events list contains columns like
- Title -Single line of text
- Event date-Date/Time
- Attendees-Person
- Organizer- Person
Now, let’s create a flow that will delete SharePoint list items based on date using Power Automate.
Step 1: Open Power Automate Cloud, then click on the +Create icon -> select Instant Cloud flow.
Then, provide the flow name, select Manually trigger a flow, and then click on Create.
Now you can see that Manually triggered flow action is added to the flow page. Next, click on +Add an input icon, and then select the Date option like below.
Step 2: Next, we will get items whose date is 10-12-2023, click on the +New step and then select the Get items action, and then provide the below information:
- Site address: Provide the SharePoint site address
- List name: Select the list from the dropdown.
Then click on Show Advanced options:
- Filter query: Provide the below query:
Eventdate eq '@{formatDateTime(triggerBody()['date'], 'yyyy-MM-dd')}'
Step 3: Now we will delete items based on the given date, so click on the +New step -> select Delete item action. Then, provide the information below.
- Site address: Provide the SharePoint site address
- List name: Select the list from the dropdown.
- Id: Select the id from the dynamic content. This will automatically add Apply to each action to the flow as we are working on multiple items.
Step 4: Now run the flow and provide the date, and you can see the items are deleted from the SharePoint list, whose date is 10-12-2023.
This is how to delete all items from the SharePoint list based on the date using Power Automate.
Delete SharePoint list items older than 7 days using Power Automate
Here, we will see how we can delete list items older than 7 days using Power Automate.
For example, we will take the same SharePoint Event list, and we will check if the Event date is older than 7 days or 1 week from today. Then, we will delete all those events from the SharePoint list.
For this, we will create an Instant cloud flow and then get items older than 7 days. After that, we will delete all items from the Sharepoint list.
Now let’s create a flow, that will delete all SharePoint list items that are older than 7 days using Power Automate.
Step 1: Open Power Automate Cloud, then click on the +Create icon -> select Instant Cloud flow.
Step 2: Then, provide the flow name, select Manually trigger a flow action, and click Create.
Now you can see that Manually triggered flow action is added to the flow page in Power Automate.
Step 3: Next, we will get items that are older than 7 days. click on the +New step and then select the Get items action, and then provide the below information:
- Site address: Provide the SharePoint site address
- List name: Select the list from the dropdown.
Then click on Show Advanced options:
- Filter query: Provide the below query:
Eventdate le '@{addDays(formatDateTime(utcNow(), 'yyyy-MM-dd'),-7)}'
Step 4: Now we will delete items that are older than 7 days, so click on the +New step -> select Delete item action. Then, provide the below information.
- Site address: Provide the SharePoint site address
- List name: Select the list from the dropdown.
- Id: Select the id from the dynamic content. This will automatically add Apply to each action to the flow as we are working on multiple items.
Step 5: Now run the flow, and you can see the items that are deleted from the SharePoint list are older than 7 days.
This is how to delete all items that are older than 7 days using Power Automate.
Conclusion
I hope now you have a complete idea of how to delete items from the SharePoint list using Power Automate. Also, we cover the below topics
- Power Automate delete items from the SharePoint list based on the date
- Power Automate delete SharePoint list items older than 7 days
You may also like:
- Send a Customized email when a new item is created in a SharePoint list using Power Automate
- Convert String to Date for SharePoint list using Power Automate
- How to Convert True to Yes in Power Automate?
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com
Thanks, worked. However didnt clear the last 32 entries for some reason, ran again and it cleared the rest.
This worked, but only deleted the first 100 list items? Is there a way to delete all 500 list items that are in my list?
I’m the same, it only deleted the first 100 … any suggestions?
I am also having a list with 15k (Part no data) i have to delete from time to time.
Here only first 100 items are getting deleted, as Scott described too.
Same issue here, not really a viable option if it doesn’t actually delete everything… Other options?