web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Permanently delete ite...
Power Automate
Unanswered

Permanently delete items in a SharePoint list

(0) ShareShare
ReportReport
Posted on by 22,505 Super User 2025 Season 2

Hi Everybody,

 

As a requirement for a solution all data older than a year needs to be permanently deleted on a monthly basis, at the beginning of the month for the previous month. The data source is a SharePoint list and there's possibility of having more than 5000 items per month.

 

The solution I got working so far is a scheduled cloud flow that uses threads to retrieve the items older than a year (to deal with the possibility of having over 5000 items) and then deletes them permanently:

 

To get the items

BCBuizer_0-1672671669687.png

 

And then to delete them:

 

union(
outputs('Send_an_HTTP_request_to_SharePoint_-_Get_items_older_than_a_year')[0]['body']['value'],
outputs('Send_an_HTTP_request_to_SharePoint_-_Get_items_older_than_a_year')[1]['body']['value']
)

 

BCBuizer_1-1672671760492.png

 

However, it seems like an extra step to first get the items and then delete them. I believe there must be a way to delete these items directly, but unfortunately my attempts to get "merge" the two HTTP requests have not yet been successful. 

 

Can anybody support me in finding the way to getting this to work?

Categories:
I have the same question (0)
  • lbendlin Profile Picture
    8,474 Super User 2025 Season 2 on at

    If you knew all the IDs of the files you want deleted then you wouldn't need the GET request. But your process requires you to run one GET query and then iterate through the results with the DELETE query.

     

    Not sure what the UNION is supposed to achieve but the rest looks reasonable.  I would guess it might be rather slow though.

     

    Have you considered using the native SharePoint data retention policy instead?

  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @lbendlin ,

     

    The point of the HTTP GET is to get the IDs I need to delete, but I figured I should be able to "nest" this somehow in the Uri for the HTTP DELETE. In all this takes a few minutes to run, so it's not the slowest method in the world, but whatever optimisation is possible, I'm interested.

     

    I'll have a look at the retention policy.

     

    Ps. The purpose of the UNION is to join the outputs of the two threads (both 2500+ items).

  • David_MA Profile Picture
    12,966 Super User 2025 Season 2 on at

    The simplest solution would be to set up a retention policy on the list based on the Created date.

    David_MA_2-1672691082534.png

     

    You would find this in the list settings under Information management policy settings. If this is not listed in the list settings, you will first need to go to your site settings. Under Site Collection Features, turn on In Place Records Management.

    David_MA_1-1672690887443.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard