Originally published at: Controlling file retention on files uploaded with the Outlook Add-in - Nextcloud
One of the more powerful features in Nextcloud is the auto-tagging feature combined with files retention control. This enables admins to control the life cycle of data. For example, you could delete files replacing email attachments using the latest version of the Nextcloud Secure Sharing Outlook Add-in after a set period. In this blog we will show how to do exactly this!
Why?Many organizations have legal reasons to not keep data around too long. They would delete emails after 3 months, for example. But if you use the Nextcloud Outlook Add-in, attachments would still be available through the links in the email. Nextcloud has the ability to delete those automatically with our Retention app.
It could also be a measure to keep storage costs under control. If your company exchanges large files with customers, deleting all files over 1gb of size after a week or two might make a lot of sense.
The Outlook Add-in[caption id="attachment_4352" align="alignright" width="300"] The activity view shows you when a recipient downloaded or uploaded files[/caption] The Nextcloud Secure Sharing Outlook Add-in stores data in Nextcloud instead of as attachments to emails. This has several direct benefits:
- Emails become smaller, saving storage on the mail server and inboxes of senders and recipients
- The IT department is in control over the data, with security policies enforced by File Access Control in effect
- Files and folders exchanged can be of any size and amount
Controlling file access and limiting life timeOnce data is on Nextcloud instead of in hard-to-track emails, the usual IT capabilities provided by Nextcloud can deliver security, legal and practical control. Not only are File Access Control rules enforced, the Outlook Add-in can be recognized and special policies can be configured. In this example, we show how to tag files from the Outlook Add-in as "Outlook" and set up a policy to delete them after 30 days, but only if they are larger than 100 mb.
First, we have to check if the automated tagging app and the retention app are enabled. If they are, we can proceed to the settings screen and move there to the Workflow tab.
Now, we create a tag named ‘old email attachments’, making it invisible to users.
Then we assign this tag when the Request user agent matches. In Nextcloud 14 or newer, you can simply select the Outlook add-in from the drop-down menu. In older versions, you have to use a regular expression. The outlook client has the following user agent:
Mozilla/5.0 (Microsoft Windows NT 10.0.16299.0) Nextcloud-Outlook v184.108.40.206
Of course, the version number changes. In the end, what we care about is the Nextcloud-Outlook part, so we define this regular expression:
((Mozilla/).( ().())( Nextcloud-Outlook v).*)
This will select all files uploaded with the outlook client. We also add that file size has to be over 100 MB.
Finally we set the File retention for files with this tag on 30 days!
That is all that is required. Nextcloud will assign our defined tag to files over 100mb when they are uploaded with the Outlook Add-in, and the retention app will remove these files 30 days after their creation.
Here is a screenshot when using Nextcloud 14.0.3, just picking the Outlook add-in from the drop-down and deleting files after 7 days - no need for a regular expression in our latest version!
Hopefully this blog gives some inspiration to people looking to control the lifecycle of data on their Nextcloud server!