Everyday Automation With Microsoft Power Automate

One of my favorite tools these days is Microsoft Power Automate (formerly Microsoft Flows). Power Automate lets you visually construct workflows for all kinds of things, and I’ve found it to be an incredibly powerful way to automate tasks. Here are some examples:

  • Post in Slack when an email is sent to a shared mailbox
  • Post status tweets from a SaaS provider’s Twitter account in Slack
  • Send an SMS text message when a critical process fails

The thing I love most about Power Automate is that you can make sophisticated workflows very quickly, and they don’t require hosting or deployment. You just create, save, and it’s live.

Many of my workflows start by me realizing that I didn’t notice a certain category of emails quickly enough or that I need to give my team better awareness of an event. For example, I wanted to ensure that expense reports get approved right away so that employees get reimbursed, so I created a workflow to send a direct message in Slack whenever I get an approval request email from the expense system. Another common example has been to notify my team when applications report failures through various means.

Power Automate boasts a “low code” experience, but most of the workflows I’ve created have required coding skills and creative troubleshooting to figure out. That said, you can still do useful things with pretty much zero code as long as you’re not trying to get too fancy. In this post, we’ll build a simple workflow that posts a notification to Slack when an email comes in.

We begin by creating a new automated workflow. Automated workflows always start with a trigger, so I’m going to pick “When a new email arrives.” Another option that’s been useful to me is “When an email arrives in a shared mailbox,” but as you see in the screenshot below, there are many options to explore–and many that have nothing to do with email, as well.

If you’re automating something for an unmonitored mailbox, you may not want additional criteria, but I’m usually looking for something like an email from a specific sender with a certain subject. So, the next step in our workflow will be a Condition so we can specify which criteria we care about.

The last step in our workflow will be to define what happens when the condition is met or not met. We want our sample workflow to send a private message in Slack. To accomplish this, I’ll add the “Post message to Slack” step and enter my Slack username for the channel and some text for the message. Instead of hard-coded message text, you could also include attributes from the email message entity, similar to those used in the condition step.

The final step is simply to save it. That’s it. When an email arrives, the workflow checks it against the conditions you’ve defined, and performs the corresponding Yes/No actions–in this case send ourselves a message in Slack.

Clean-up Your Inbox With Retention Policies

I get a lot of email, and I can’t always keep up with it. My first line of defense is rules. Rules help me filter out a lot of noise and tag messages in meaningful ways, but I find that if I move things out of my inbox, they slip into the out-of-sight, out-of-mind void that is everywhere-except-my-inbox.

I get a lot of notifications from Azure DevOps for things like pull request reviews. These are things that I want to know about, but it’s not something I’m realistically going to get back to if I put it off for a few days. I wanted to create a rule that was something like “delete messages that match [whatever criteria] that are more than [x] days old,” but I couldn’t find a way to do it other than by moving the messages away from my inbox to a folder with a custom archiving policy (i.e. into the void where I won’t see them) or by doing some custom development.

But then I found them: retention policies.

Retention policies control how long messages messages are kept, and they’re perfect for these sorts of highly-relevant-but-only-for-a-short-while messages. You apply the policy to a message, which can be done quite easily with inbox rules, and Office 365 takes care of the rest.

Sounds awesome; sign me up, right? It took me an embarrassingly long time to figure out how to add the policies to my account and use them. I’m talking 2 or 3 sessions where I gave up, defeated. Fear not, though, friends! For I have figured out the path forward and present it to you here in just four easy steps.

1-3. Add Policies to Your Account

This was the part that escaped me for so long, and the issue is that I was trying to do it from Outlook instead of through the Outlook Web App.

  1. Log into O365 > Outlook
  2. Settings > View all Outlook settings > Retention Policies
  3. Add new policy > (add some policies)

Alternatively, you can jump directly to the following URL:
https://outlook.office365.com/mail/options/mail/retentionPolicies

4. Make a Rule

Now that you’ve added some retention policies, you can apply them to messages with rules. As mentioned earlier in the post, I want to delete messages from Azure DevOps after a few days, so I created a rule that applies the “1 Week Delete” policy to them.

When these messages come in, they can sit comfortably in my inbox and compete for my attention. If I happen to get a behind–which happens frequently enough for me to have pursued this several times and then write a blog post about it–these stale messages will conveniently self-destruct and go away all by themselves. Wonderful!

Two Ways to Send Emails to Slack

I get a lot of emails where I want to discuss with my team in Slack, and I was really excited when the Send to Slack Outlook add-in was created. It’s really nice to click a button, specify a channel, and have the email show up.

Unfortunately, I noticed yesterday that things like screenshots & images contained in an email message may not show up when the add-in is used. However, just today I happened upon another setting in Slack preferences that allow you to generate a unique email address. When you send emails to this address, they come as a direct message from Slackbot–and images that didn’t show up in emails sent with the Outlook add-in did show up when I sent them to this email address.

The setting is found in Preferences > Messages & Media > Bring Emails into Slack.



Sync Any Folder Between PCs with OneDrive

OneDrive is great for backing up data to the cloud, but one of its limitations is that you are only allowed to specify a single folder. I had an application that I used frequently between two computers, and I needed to manually copy files between the computers any time I changed settings.

After doing a bit of research, I found a great solution utilizing OneDrive and junctions created using mklink. The secret to this approach is to keep the “real” files in your OneDrive folder, and then create the links from the original path.

Here’s a quick example to demonstrate. Let’s assume I have a directory c:\users\adam\foo\settings that I want to sync between computers. I would perform the following steps:

  1. Make a backup of c:\users\adam\foo\settings just in case something goes wrong.
  2. Copy settings into my OneDrive folder → c:\users\adam\onedrive\foo\settings
  3. Delete c:\users\adam\foo\settings
  4. From a command prompt, run the following:

    mklink /j "c:\users\adam\foo\settings" "c:\users\adam\onedrive\foo\settings

That takes care of one PC so that it will use the files that are now contained in the OneDrive folder, but it’s only half the battle. Now we need to switch over to the other PC and configure it to use the OneDrive files, too. I’ll use a different username in my path to help illustrate that these steps are being performed on computer #2.

  1. Make a backup of c:\users\adam.prescott\foo\settings
  2. Delete c:\users\adam.prescott\foo\settings
  3. From a command prompt, run the following

    mklink /j "c:\users\adam.prescott\foo\settings" "c:\users\adam.prescott\onedrive\foo\settings"

Now both computers are configured to use the files contained in the OneDrive folder, and changes will sync between them as changes are made. Perfect!

Lenovo Caught Installing Adware On New Computers

Tsk, tsk Lenovo.

The adware, named Superfish, is reportedly installed on a number of Lenovo’s consumer laptops out of the box. The software injects third-party ads on Google searches and websites without the user’s permission.

via Lenovo Caught Installing Adware On New Computers.

Introducing Quick File Search | Bitbucket Blog

I’m glad I found this, I’ve really been needing/wanting it. In Bitbucket, you can press ‘F’ to bring up a quick-search dialog and type in any file name to find & jump directly to a file in the repository. Until now, I’ve been manually clicking through directories and hating every second of it! (But this is apparently old news. Using ‘.’ to open the Omnibar is the way to go now. Exact same idea, though!)

Introducing Quick File Search | Bitbucket Blog.

New Home Office & the IOGEAR Dual View Dual Link DVI

I just recently moved back into my house, and a lot’s changed since I was here. Perhaps the most notable difference is that home and work have combined. So, when it came time to configure my home office, I wanted to make sure I had everything I needed to adequately work and play in the same space while also keeping them sufficiently separate.

Let’s talk needs. Two monitors is a minimum for work. Some people like a third display, but it’s give-or-take for me. I find that I’ll be looking at the far-left monitor and not notice something important that’s happening on the far-right. I’m not anti-third display; it’s just not something that I particularly care about. I like two displays for home for some of the same reasons. If I’m learning something, I want to have a page up on one screen while I work on the other. Or, maybe I want to poke away at some code while watching some TV. Either way, two screens makes life better. The old home office had my home and work computers in different rooms because I didn’t have a proper office, but it was time for them to unite.

This union created a dilemma: two computers, three monitors, two keyboards, and two mice. Seems like a perfect job for a KVM, but I was surprised to find that multi-display KVMs aren’t cheap. After a night of research, I decided it would be worth it to splurge and get an IOGEAR 2-port MiniView Dual View Dual Link DVI. On paper, it’s just what I needed. Two monitors, a keyboard, and mouse could be shared between the two computers. The third monitor would be hooked up to a DVR for some entertainment on the side, but it could also be used as a third display for either computer if desired. (I’d change the third display manually using its built-in source selection.)

iogear-miniview

The MiniView is a cool piece of hardware. It’s got some decent weight to it, and the metal case and buttons look nice–essential for a desktop peripheral! I ran into some hiccups hooking everything up, but I think it may have been because I was hot-swapping everything instead of turning everything off like recommended in the user manual which, of course, was not read until after the fact. The functional shenanigans during setup caused the initial configuration to take the better part of 2 hours and was really frustrating. I was definitely feeling some buyer’s remorse and considering sending it back, but I got it working after a few reboots and do-overs.

Okay, initial setup was done. Displays were working; keyboard was working; mouse was funky. I’d read some reviews about issues with wireless mice, so I wasn’t entirely surprised by this. I had a nice gaming mouse, so I decided to just roll with that, but I couldn’t do it. I missed my Logitech Performance MX and had to go back. Fortunately, the MiniView has a USB port to share a single peripheral between computers. I plugged my Logitech universal receiver into it, and the mouse worked just fine. Boom, problem solved.

I was all done, or so I thought. I ran into another problem a day or two later, this time with the keyboard. The “t” got stuck, and even unplugging and re-plugging it in didn’t solve the issue. So, I grabbed a cheap 3-port USB hub that I had laying around, plugged it into the single shared port on the KVM, and plugged my mouse, keyboard, and wireless headphones receiver into it. Now I’m not using either of the KVM’s dedicated USB keyboard or mouse ports, but everything works perfectly. I lose out on the KVM-specific keyboard and mouse commands, but the KVM is front & center on my desk so I probably wouldn’t be learning or using those commands, anyway.

Everything’s been good for another day or two at this point, and so far, so good. I’m feeling good about this configuration and hope it keeps working!

Oh, and if you’re curious about the monitor/computer connections, my two monitors connect to the KVM via HDMI-to-DVI cables. Computer 1 is connected to the KVM using the KVM’s provided DVI+USB cable and a DVI-to-HDMI cable. Computer 2 uses the DVI+USB cable and an additional standard DVI cable. The third display connects to Computer 1 using a VGA cable (Computer 1 only supports 3 displays if one is VGA), Computer 2 using a standard HDMI cable, and the DVR using a standard HDMI cable. I’m generally keeping the third display disconnected from the computers (through their display control panels) and just using it as a TV, though.