Information Rights Management Retention Policies have been a part of SharePoint for a loooong time. It’s an ideal tool to automate the process involved in the document life cycle. As the amount of documents in an organisation increases, it might get hard for us humans to keep track on every old document or record. We can use retention policies to automate the life cycle of these in SharePoint.
In short, you can use a retention policy to do something after a certain criteria is met. For example, when ‘Created Date’ is two years in the past, delete the document.
Or when ‘Published Date’ is one year in the past trigger a Workflow that sends an email to the creator of the document. For more information on setting up retention policies, check https://sharepointmaven.com/set-retention-deletion-policies-files-folders-sharepoint/.
Not available in Office365
But! When you create a new Office 365 Tenant you’ll notice that you can no longer use Information Rights Management by default. Now, there are ways to turn this back on again, but this is not always possible. You need to be Tenant Admin to do this, and this might not be the case in your organisation.
Might Flow be an alternative?
Ha, you say, but now we have Flow. Surely we can build an even better retention policy with this fabulous tool. Well….. perhaps, but there are a few caveats.
There are actually two commands in Flow that might do the trick:
Delay (until) for short term actions.
You could add a ‘delay’ or a ‘delay until’ action to your flow.
This will delay the flow for a specific number of days, or till a specific date. After that time is passed, you can put in a condition to check if a file needs to be archived yes or no.
Now the problem with this method is all the time this is happening, the flows are still running. So changes might be made to the file, but in the meantime the flow will still wait till the delay is over.
But the biggest problem is that the maximum delay-time is 30 days. That is all you’re getting from Microsoft (and with good reason, you dont’s want to have thousands of unfinished Flows in your environment). This method is okay for short term actions and notifications, but not a valid method for long term Record Life Cycle Management.
Pros & cons
+ Trigger flow after a specific date
+ Roughly works in the same way as the classic retention method
– Flows stay open during the waiting period
– Maximum of 30 days
Scheduled – Recurrence Flows
Another way of doing it is not by triggering after a specific date or period of time, but by daily checking if a certain condition is met.
Let’s say we have a Document Library with an extra Column called ‘PublishDate’.
Now one year after a document is published it can be deleted. You can’t use the Delay flow function, because of the 30-day limit. You can however use the Recurrence function. Lets take it step by step:
- As a trigger, set a Recurrence (1). Put it on a 1-day interval.
- Use the Get Files function to get the files you need. You can put a condition right in this function in the Filter Query (2) part. The complete query including the expression is as followed:
PublishDate gt formatDateTime(addDays(utcnow(),-365),’dd-MMMM-yyyy’)
Basically it says when the PublishDate is Greater than today minus 365 days (older than one year).
- Lastly you put in your action. In this case Delete File (3). Flow will automatically put an apply to each around this
This looks like an ideal solution. There are however a few things to consider. The apply to each has a limit of 5000 items (100.000 for premium plans). Does that mean our library can’t be greater than 5000 items?
Not exactly. You see, the limit only applies to the outcome of the get files function. This is why you should always try to use the filter query instead of having a condition after the get files function. As long the outcome of the filter query is less than 5000, there is nothing to worry about.
Another thing to consider is that this might put a strain on your tenant. So it’s best to plan the recurrence on relatively slow hours.
Pros & cons
+ Only costs you one flow per day
+ No Idle running Flows
+ No 30-day limit
– Keep an eye out for the apply to each limit
To answer the question in the title: Is Flow a working alternative for Information Rights Management Retention Policies?
Absolutely! Recurrence flows seem to be the best fit. Just make sure to mind the item limits.