Forum Discussion
Deleting old rows from a SharePoint list
Hi,
I am using a SharePoint site as a database for a desk booking system.
The data is held in SharePoint lists.
I want to delete old data, i.e. items older that 1 month
Is there an easy way to do this?, the list contains thousands of records from the past 4 years.
Thank you for your time,
Ollie
2 Replies
- grant_jenkinsIron Contributor
Ollie Another option, in addition to what Rob mentioned, is to utilize the in-built list retention.
- Go into Site Settings > Site Collection Features > enable Library and Folder Based Retention
- Go into your List Settings > Information management policy settings > click on Item > select Enable Retention
- Add a retention stage > Set Time Period to Created Date 1 month then click on Ok. This should delete your items automatically after 1 month of creation (you can choose to have them permanently deleted or sent to the recycle bin).
IMPORTANT: For any of these solutions, I'd highly recommend trying them out on a Test List first to ensure they work as expected.
- Rob_ElliottBronze Contributor
The simplest way would be to use a flow in Power Automate with the filter query in the get items set to the expression of Created lt addDays(utcNow(),-31). The add an apply to each with a delete item action inside it. As the default number of items returned in the get items action is 100 you will need to go to the Settings of the Get items action, turn on pagination and set the threshold to more than the number of items in your list. Do note that the flow will take quite a while to run.
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, Microsoft Power Platform, WSP Global (and classic 1967 Morris Traveller driver)