With the script in place the next step was figuring out how to run it on a day to day basis. The solution I settled on was to run the script every 5 minutes using launchd.
To make this work, I first needed to create a Launch Agent or Daemon. According to the docs, Launch Agents are to be run when logged in as a specific user whereas Daemons are system level and run outside of a specific user session. In my case a Launch Agent seemed more appropriate since all these rules are specific to my Outlook account.
I then needed to create a property list file in ~/Library/LaunchAgents. Here is what that looks like. All the other files in ~/Library/LaunchAgents were scoped to a particular domain so I decided to do the same with mine.
I then loaded the script from ~/Library/LaunchAgents using
launchctl load -w uk.co.29ways.outlook-cleanup.plist
Once loaded I tested the script using
launchctl start uk.co.29ways.outlook-cleanup
To tell if the script ran correctly, I used
launchctl list | grep outlook
The second column indicates the return code of the last run of the agent which all being well will be 0. If there was a problem then this will be non-zero and hopefully there will be an indicator in the log of what went wrong