Sensei Blog

The blog about Microsoft productivity, project and portfolio management and business insights solutions. Subscribe to receive the Sensei Newsletter!


Transform forgotten emails into organised tasks in Microsoft Planner

Like a lot of people, I find that following up on the various Outlook emails I receive can be a real hit or miss experience. I’ve tried several methods – some of them more successful than others, but recently my mind turned to another Office productivity tool I’ve taken quite a shine to, Microsoft Planner.

For a busy developer like me, Planner is an attractive tool for organising your work that doesn’t fall inside the traditional software development pipeline. The ability to customise the stages of your activities, the visualisation dashboard and the automatic email reminders are all features that I find useful and as such I’ve found myself using it increasingly frequently for client work.

It’s almost inevitable that given such a tool, I’d want to use it to keep track of all my miscellaneous tasks which, as it so happens, tend to come almost exclusively from email. So, the question then becomes, “How can I turn this email I just got from a client into a task that I can follow up on later?” The answer it turns out, is Microsoft Flow.

In this blog post, I’m going to demonstrate how you can create a Task in a custom Plan by simply clicking the ‘follow up’ flag in your Outlook client. The entire process, from start to finish, should take about 15 minutes to do.

Make a Plan

The first step is to log into Microsoft Planner and to create a new custom plan. You can get to both tools (Flow and Planner) by simply expanding your apps icon in Office 365.

For now, go ahead and log into Planner. Once there we’re going to make a new plan to store your new “tasks” that will be generated by your emails. You can see here that I made one and I’ve called it “Followup Emails”. That name is important, remember it, you’ll need it later to hook up your flow.

And now, my new plan, all nice and empty.

I didn’t really modify anything here and I’m somewhat counting on the default behaviour of Planner to achieve what I want (automatic notifications when tasks are overdue). From here I could potentially copy the items that get made in this planner to yet another planner, perhaps one that is more specific to a job or client I am working with.

Make a Flow

This is the real meat of the tutorial. We’re going to create a flow that triggers when you flag an email in Outlook, the entire process (from top to bottom) should take you about 10 to 15 minutes to complete, following these steps.

For now, go into your “My Flows” tab and select “Create from blank” and then search for the first operation, “Office 365 Outlook – When an email is flagged”. If this is your first time using Flow, the application will probably have to authenticate your connectors, but it’s not a big deal and only takes a second.

Once you’ve selected the correct trigger, you’ll be presented with your first step in your new flow – the trigger.

We’re not going to do anything with this guy, but you could potentially add more filters to the trigger here.

Click on “New Step” below that step and then select “Add an action” from the dialog. We’re going to be searching for an action named “Office 365 Users – Get my profile (V2)”. Select it and add it to your flow.

You don’t really need to do anything at this stage either – we’re just going to use this step to pass along some vital information to future steps, so let’s keep progressing. Let’s go ahead and add another action called “Initialize Variable”.

We’re going to create a flag here that is used to prevent this flow from adding the same task repeatedly to your planner. Particularly useful if you tend to go a bit click crazy with your mouse like me.

Now add another action for, “Html to text”. This is something we are going to use to strip HTML tags out of the emails we are going to be copying to the task body in planner.

The interface here should be intuitive – put your mouse in the box, then navigate to Dynamic content called “Body” which is an output from initial Outlook step. The dialog for this appears to the right of your steps and has a handy search bar that works great. Try it out.

Now with our message properly stripped of HTML, let’s start working on putting it into planner. Add a new step, this time searching for “Planner – List tasks”. This is where we’re going to start checking our plan to see if we have an already existing task with the same name (subject header in this case, as we are copying an email into a task). You’ll need to enter the name here of whatever you called your Office Plan in the very first step. Mine is “Followup Emails” – Select it from the drop-down box in the Flow step.

Now we’re going to add a new type of action, it’s called an “apply to each”. You can get to it by selecting the “More” button from “New Step”, it’s labelled “Add an apply to each”. Programmers will probably instantly figure out what this does, but for the rest of you, it’s pretty simple – we’re going to do a test against each item in our plan to check to see if the name matches the name of the task we are going to want to create. This will prevent us from making duplicate tasks.

Don’t be afraid of this guy, it’s pretty simple. First thing – enter the “value” output from the previous step, “List tasks” then click “Add a condition”. You’ll get the layout in the picture above. For the condition we are going to check to see if the task’s “Title” field is equal to the Subject line of our email. Once that’s done, go to the “if yes” box (it’s in green!!) and add an action, “Set variable”.

From there, select “TaskExists” from the drop down (you initialized it earlier to false) and set the new value to “true”.

Now, go and add another step below this one. It’s going to be another condition, one where we are going to check to see if the “TaskExists” flag is still set to false.

In the “if yes” box we are going to add our next steps and finish off this tutorial.

First select “Create a task” from Office Planner.

This is a critical step – ensure that you use the Subject from your email as the Title for your task, otherwise the last couple of steps will be pretty much worthless! After that, go ahead and select the “User Principal Name” for your Assigned User Id – this value is being carried forward all the way from the second step in this flow, neat huh?

Now we’re going to do something kind of cool – We’re going to set the start date for this task to today, and the due date to be a few days in the future. Doing this is going to activate the default reminder / notification behaviour of Planner.

Put your mouse in the “Start Date Time” field and then click on the “Expression” tab of the dynamic content dialog. Once there type the following:

addHours(utcNow(), 10)

and then press “Okay”.

The number ‘10’ in that expression is my time offset, I’m +10 from UTC time. You can change it to whatever is appropriate for your own time zone, just look on Google if you’re unsure as to what your time offset is.

After this step, let’s go and add the Due Date Time.

The formula for this step is:

addDays(addHours(utcNow(), 10), 5)

This will make the task ‘due’ 5 days in the future so that we get reminders when it’s becoming close to over-due.

The next step is a bit of a “gotcha” – there appears to be a tiny bug in the Office Planner API where there is a delay in the system acknowledging that you’ve created with a valid task ID. The short and long of it is – we’re going to add a tiny delay before copying the email into the task, just to be safe.

Add a new step below the previous one and search for “Delay”. 10 seconds should be more than enough.

We’re almost there – just one last step until we finish!

Add another action, this one called “Update Task” from Planner. In this step we are going to update the task we just created with the text we formatted from the email (remember way back at the third step?)

All you need to do in this step is to carry forward the ID from the task you created into the Task ID field and the output from the Html to text conversion into the “Description” field. This will show up when you double click the task in Office Planner Once you’ve done that go ahead and save your flow.

Now, it’s time to test!

Probably the easiest way to do this is to do it from this interface – there is a “Test” button with a laboratory beaker right next to the save button. Click that and then select “I’ll perform the trigger action”.

After that’s done, go into Microsoft Outlook and find an email to test on – one of my fellow consultants handily provided me with one. I’ll click that “follow up flag”.

At this point you should be able to “see” your flow running in the Flow editor. Once it completes (and assuming no problems!) you should be able to go into your plan and see the new task!

And when I double click on it, I see:


As you can see, Microsoft Flow is a pretty handy and powerful tool. The interface is, as far as these things go, fairly intuitive and easy to grasp. As a programmer, I feel a little cheated – shouldn’t I be typing code to do this kind of stuff?

All kidding aside, this is a great tool for enhancing productivity and integrating disparate systems. There are already a hundred or more connectors available to different applications and more being created every week and considering how pleasant it was building such a simple integration in this tool, I’m more than happy to say that I’ll be trying to “Go with the Flow” as much as possible in the future!

By John Martinez, Senior Developer / Architect at Sensei Project Solutions.

Want a hand transforming forgotten emails into organised tasks in Microsoft Planner? We’d love to hear from you.

  • This field is for validation purposes and should be left unchanged.

Stay up to date with insights from the Sensei Blog

  • This field is for validation purposes and should be left unchanged.