Power Automate delete all items in SharePoint list

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.

power automate delete all items in sharepoint list
power automate delete all items in SharePoint list

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.

How power automate delete all items in sharepoint list
How power automate delete all items in SharePoint list

Next, provide the flow name and select Manually triggered Flow. And then click on the Create.

Microsoft Flow delete all items in sharepoint list
Microsoft Flow delete all items in the SharePoint list

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.

How Microsoft Flow delete all items in sharepoint list
How Microsoft Flow delete all items in the SharePoint 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.

MS Flow delete all items in sharepoint list
MS Flow delete all items in the SharePoint list

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.

How MS Flow delete all items in sharepoint list

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.

power automate delete all items in sharepoint list based on date
power automate delete all items in sharepoint list based on date

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.

How power automate delete all items in sharepoint list based on date
How power automate delete all items in sharepoint list based on date

Now provide the Flow name and set the time and interval. Then click on Create.

Microsoft flow delete all items in sharepoint list based on date
Microsoft flow delete all items in the SharePoint list based on date

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'))
How Microsoft flow delete all items in sharepoint list based on date
How Microsoft flow delete all items in sharepoint list based on date

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.

How MS flow delete all items in sharepoint list based on date
How MS flow delete all items in SharePoint list based on date

Step 4: Run the Flow

Now click on Save and run the flow manually, you can see all items before 2 days are deleted.

MS flow delete all items in sharepoint list based on date
MS flow delete all items in SharePoint list based on date

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.

Microsoft Flow delete sharepoint list items older than
Microsoft Flow delete SharePoint list items older than

In Power Automate, select the Scheduled cloud Flow, then provide the Starting date and time and set the frequency every day, click on Create.

Power automate delete sharepoint list items older than
Power automate delete SharePoint list items older than

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))'
MS Flow delete sharepoint list items older than
MS Flow delete SharePoint list items older than

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.

delete sharepoint list items older than 7 days using MS Flow
delete SharePoint list items older than 7 days using MS Flow

Now click on Save and run the flow manually, you can see the items that get deleted that are older than 7 days.

delete sharepoint list items older than 7 days using Microsoft Flow
delete SharePoint list items older than 7 days using Microsoft Flow

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.

Power automate delete items from an array
Power automate delete items from an array

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.

Microsoft Flow delete items from an array
Microsoft Flow delete items from an 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'))
MS Flow delete items from an array
MS Flow delete items from an array

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))
delete items from an array using MS Flow
delete items from an array using MS Flow

Now click on Save and run the flow manually, and you can see the last item present in an array.

delete items from an array using Microsoft Flow
delete items from an array using Microsoft Flow

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.

power automate delete sharepoint list attachments
power automate delete SharePoint list attachments

In Power Automate, select the trigger ‘When an item is created‘ action. Then provide the Site address, list name.

Power automate SharePoint delete attachments
Power automate SharePoint delete attachments

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.

Microsoft Flow SharePoint delete attachments
Microsoft Flow SharePoint delete attachments

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.

MS Flow SharePoint delete attachments
MS Flow SharePoint delete attachments

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.

MS Flow delete sharepoint list attachments
MS Flow delete SharePoint list attachments

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.

Microsoft Flow delete sharepoint list attachments
Microsoft Flow delete SharePoint list attachments

Now click on Save and create an item with an attachment to run the flow.

 delete sharepoint list attachments using MS Flow
delete SharePoint list attachments using MS Flow

Once the flow ran successfully, you can see the attachment get deleted from the list.

delete sharepoint list attachments using Power Automate
delete SharePoint list attachments using Power Automate

This is an example of Power Automate deleting SharePoint list attachments.

Related Power Automate tutorials:

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
  • >