In this Power Automate or Microsoft Flow tutorial, we will discuss how to delete all items in the SharePoint list automatically using Power Automate. And also we will discuss how to delete items from the SharePoint list based on date using Power Automate.
Here we will cover the below examples:
- Power Automate delete all items in SharePoint list
- How to delete all items in SharePoint list based on date using Power Automate
- Power automate delete sharepoint list items older than
- Power automate delete items from array
- Power automate sharepoint delete attachments
Power Automate delete all items from SharePoint list
Here we will create a flow delete all items in the SharePoint list using Power Automate or Microsoft Flow.
I have created a SharePoint list called Technology, so in this list, we have 3 items and we will delete all items automatically.
Let’s see how to create a flow to delete items from the SharePoint list.
Step 1: Create a Flow in Power Automate
To create a flow, log in to Power Automate, and then click on Create and select Instant Cloud Flow.
Next, provide the flow name and select Manually triggered Flow. And then click on the Create.
Step 2: Retrieve items from the SharePoint list
In this step, we will retrieve items from the SharePoint list, so click on the Next step and select Get items action, then provide the site address and list name of the list.
Step 3: Delete all items in the SharePoint list
In this step, we will delete all items in the SharePoint list, so click on the Next step and select Delete item action. Then provide the site address, list name, and id from the dynamic content and it will automatically add Apply to each action.
Step 4: Run the Flow
Now click on Save and run the flow manually, and you can see all items get deleted and the list get empty.
This is how to delete all items from SharePoint list using Power Automate.
Read How to get email address from name in Power Automate
Power Automate delete all items in SharePoint list based on date
Here we will see how to delete all items in SharePoint list based on date column using Power Automate or Microsoft Flow.
I have a SharePoint list called Events, So we will create a flow that will trigger every day and look for event date column which is older than 2 days, delete that item from the SharePoint list.
Let’s see how to create a flow that will delete all items in SharePoint list based on Date.
Step 1: Create a Flow
To create a flow, Login to Power Automate and then click on Create and select Scheduled Cloud Flow.
Now provide the Flow name and set the time and interval. Then click on Create.
Step 2: Get items based on date column
In this step we will get items from the list which is older than 2 days, so click on the Next step and select Get items action. Then provide the site address and list name. Next click on Show advanced options, in Filter query, write the below query to filter the item older than 2 days:
EventDate le'fx(adddays(utcnow(),-2,'yyyy/MM/dd'))
Step 3: Delete items
Now we will Delete items from the SharePoint list, so click on the Next step and select Delete item action. Then provide the site address, list name, and in id provide the id from the dynamic content, then it will automatically add Apply to each action.
Step 4: Run the Flow
Now click on Save and run the flow manually, you can see all items before 2 days are deleted.
This is an example of how to delete items from the SharePoint list based on the date in Power Automate.
Read How to convert word to pdf using Power Automate
Power automate delete SharePoint list items older than
Here we will see how to delete SharePoint list items that are older than 7 days.
So here we have a SharePoint list called Events, from this list we will delete the events automatically that are older than 7 days.
In Power Automate, select the Scheduled cloud Flow, then provide the Starting date and time and set the frequency every day, click on Create.
Next step we will retrieve the items that are created 7 days before, so click on the Next step and select Get items action, then provide the site address, list name, and in Filter query, write the below query:
Created le'fx(addDays(utcNow(),-7))'
Now we will delete items that are older than 7 days, so click on the Next step and select Delete item action, then provide the site address, list name and provide id from the dynamic content that will automatically add Apply to each action.
Now click on Save and run the flow manually, you can see the items that get deleted that are older than 7 days.
This is an example of Power Automate delete SharePoint list items older than.
Read Send an Email when Item added in a SharePoint list using Microsoft Flow
Power automate delete items from an array
Here we will see how to delete items from an array using Power Automate.
So I have an array like below, from this array we will delete the first 3 items.
[
{
"Name": "Alex",
"Age": 28
},
{
"Name": "Michel",
"Age": 38
},
{
"Name": "Celia",
"Age": 30
},
{
"Name": "Ruby",
"Age": 32
}
]
In Power Automate, select the Manually triggered Flow, then click on the Next step.
Now click on the Next step and select Initialize variable action, the provide the variable name, type as Array and in value add the above sample array.
Now we will get the length of items i.e. number of items present in the Array, so click on the Next step and select Compose action. Then in Input provide the below expression:
length(variables('varArray'))
Next, we will delete or remove front items from the array, so click on the Next step and select compose action, then in Input write the below expression:
skip(variables('varArray'),add(outputs('Compose'),-1))
Now click on Save and run the flow manually, and you can see the last item present in an array.
This is an example of Power automate delete items from an array.
Read How to create auto increment column in SharePoint List
Power Automate SharePoint delete attachments
Here we will see how to delete attachments from the SharePoint list using Power Automate.
I have a SharePoint list called Product Review, when an item is created with an attachment, then save that attachment in a folder and delete that attachment from the list item.
In Power Automate, select the trigger ‘When an item is created‘ action. Then provide the Site address, list name.
Next, we will get the attachment from the SharePoint list, so click on the next step and select Get attachments action. Then provide the site address, list name, and id from the dynamic content.
To create a file in the SharePoint folder, we need attachment content, so click on the Next step and select Get attachment content action, then provide the site address, list name, id, and File identifier from the dynamic content, that will automatically add apply to each action.
Now we will create a file, so click on the Next step and select Create File action, then provide the site address, Folder path, file name, and File content from the dynamic content.
Next, we will delete that attachment from the SharePoint list, so click on the Next step and select Delete attachment action, then provide the site address, list name, id, and File identifier from the dynamic content.
Now click on Save and create an item with an attachment to run the flow.
Once the flow ran successfully, you can see the attachment get deleted from the list.
This is an example of Power Automate deleting SharePoint list attachments.
Related Power Automate tutorials:
- Power Automate copy files with Examples
- Microsoft Flow or Power Automate employee onboarding
- The specified object was not found in the store Power Automate
- Convert SharePoint list item to PDF using Flow or Power Automate
- Power Automate Create a CSV Table
- How do I restore removed files in SharePoint with Power Automate
- Power Apps Navigate Function + 16 Examples
In this Power Automate tutorial, we learned how to delete all items from SharePoint list using Power Automate. And also we learned how to delete items based on the date using Power Automate and Microsoft Flow.
- Power Automate delete all items in SharePoint list
- How to delete all items in SharePoint list based on date using Power Automate
- Delete sharepoint list items older than in Power Automate
- How to delete items from array in Power Automate
- Power automate sharepoint delete attachments
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.
Thanks for sharing your knowledge, God bless!