We had a Retention Policy for OneDrive that led to the creation of Preservation Hold Libraries for each OneDrive account. We have now deleted the Retention Policy but the Preservation Hold Libraries are still there (and the documents are taking up storage space).
I'm new to Power Automate and I'm trying to figure out how to build a flow that will delete the files in a Preservation Hold Library of a OneDrive account (as suggested below in advice found online). A screenshot of how to approach this would be a big help!
Before this I tried using the SharePoint action Get files (properties only) and apply to each Delete file but this only worked for a Document Library in a SharePoint site. When I tried it for the Preservation Hold Library in a OneDrive account it timed out after about 4 minutes after getting stuck at apply to each Delete file.
Thanks!
@grantjenkins thanks for the reply.
The Retention Policy for OneDrive was removed 30 days prior and I have manually removed the items from my one PH library for my OneDrive account so they're no longer on hold.
The account running the flow has the required permissions to access OneDrive accounts for other staff members.
There is a large number of items in the PH libraries because it also includes the previous revisions. From experience deleting all of my own items, it took a number of bulk deletion attempts because you can only delete something like 200 items at a time (from memory).
PowerShell is an option but I don't have a sample script.
My understanding is that if you had items in the Preservation Hold Library as per the retention policy applied, then you removed the retention policy, the files would start to be deleted automatically as per the recycle bin stages/times.
I would confirm this and decide if it's worth creating a flow to delete the items or just wait for the process to resolve itself. I would expect all the files in there to be completely deleted (from both recycle bins) after 93 days after the retention policy has been removed. I'm not sure how long ago you removed the retention policies?
If you wanted to delete the items in the Preservation Hold Library you'd need to ensure all of the relevant items have been actioned for the library. Retention policies removed, eDiscovery cases closed, and Data loss prevention policies disabled.
If you did want to go ahead with a flow to delete the items: