I started playing with Microsoft To Do automation a little bit more than ~~I should~~ usual. However, I quite quickly came up to API limitations. The maximum number of items to pull is 999. That includes completed tasks. I decided I need to clean up old tasks. To make sure I do not have this issue anymore, I'd need to schedule a Power Automate task.
Note
Commercial To Do should work in similar manner but I personally store tasks on personal account
Here are the steps of my workflow:
Here's the view of the steps I perform for each list:
Part of the flow that runs for each list
To get only completed items we use:
@equals(item()?['status'],'completed')To get only items that are older than 30 days, we can use:
@less(item()?['completedDateTime']?['dateTime'],addDays(utcNow(),-30))Note
For simplicity we do not consider time zones. We also splitted the filtering to two steps for easier troubleshooting
You can download the flow from GitHub: ArchiveAllButLastServiceHealthNotification.zip
When I run the flow on 2000+ items, it took hours to complete. I gave up and deleted the items manually, letting the flow to cover the ongoing items:
Duration of flows run on bigger number of items

