Building a Productivity Mansion with Microsoft 365 Planner and Graph API
Alright, Innovator! I see you've been using Microsoft 365 Planner, and it's like you've started building your productivity mansion. As someone who's been through the process, I'd love to help you add more floors and rooms to it. So, let's pick up our productivity blueprints and continue building with these three awesome strategies.
Phase 1: Laying the Foundation with Power Automate
Just like any house, we need a strong foundation. Power Automate is like the concrete that can hold our workflows together. This tool can create connections among your favorite apps and services - think of them as the bricks and structural beams for your mansion.
Getting Started:
- Open up Power Automate
- Click Create
- Select Instant Flow
- Name your Flow
- Choose Manually Trigger a Flow
- Click Create
To create a task, like setting the groundwork, add a new step:
- Click New Step
- Search for Planner
- Select Planner - Create a Task
- Input your Plan ID, Bucket ID, and Title
What if you want to make alterations to the existing structure? No worries, add another step and search for Planner - Update a Task. Provide the Task ID and any other details you want to update and save.
You've just laid the foundation and built the first room of your productivity mansion!
Phase 2: Adding Windows with Microsoft Forms for Task Submissions
Every house needs windows to let in some light. Think of Microsoft Forms as these windows that collect inputs or feedback from the outside world (easily public-facing). You can link it to Planner to create tasks based on form responses, bringing clarity and direction to your project.
Setting Up the Integration:
- Go ahead and create a form in Microsoft Forms
- Jump back to Power Automate
- Click Create and select Automated Cloud Flow
- Under the trigger, when a new response is submitted, choose your form
- Add a Get Response details action
- Add a Create a Task action for Planner, using the form response details as the task information
- Save it
Voila! Your mansion now has windows that let in new tasks from the world outside.
Phase 3: Building a Staircase with Existing SQL Data Using the Microsoft Graph API
Lastly, a multi-story mansion needs a staircase. The Microsoft Graph API is just that - a staircase that connects different floors. In our case, it's a bridge between our existing SQL database and Microsoft Planner. Let's see how to construct this staircase using .NET.
First, we need to register an Azure App and grant the right Microsoft Graph permissions, much like obtaining the right building permits. Use your Client ID, Client Secret, and Tenant ID for authentication.
var app = ConfidentialClientApplicationBuilder
.Create(ClientId)
.WithClientSecret(ClientSecret)
.WithAuthority(string.Format(AuthorityFormat, TenantId))
.Build();
var authResult = await app.AcquireTokenForClient(new[] { Scope }).ExecuteAsync();
Now, let's pull the tasks from your SQL database that you want to add to Planner:
using (var connection = new SqlConnection(ConnectionString))
{
// Map away boss - no reason not to make it easier down the road
var taskToCreate = await connection.QueryFirstOrDefaultAsync<TaskToCreate>(
"SELECT TOP X * FROM TasksToBeCreated"
);
}
Let's make sure we're assigning the tasks to the right people! We'll fetch the User's Object ID from Azure AD:
var userResponse = await httpClient.GetAsync(
$"{GraphApiEndpoint}/users/{taskToCreate.UserName}"
);
var userResponseContent = await userResponse.Content.ReadAsStringAsync();
var user = JsonConvert.DeserializeObject<User>(userResponseContent);
Finally, we gather our task details and request the Graph API to build the staircase for us:
var taskPayload = new
{
// You can find planId and bucketId by opening the app in the web
// and checking the URL
planId = "<Your-Plan-Id>",
bucketId = "<Your-Bucket-Id>",
title = taskToCreate.Title,
assignments = new Dictionary<string, object>
{
// Fun fact: if we want the friendly name we need the
// transformation above, otherwise we can use user.UserName
{ user.Id, new { orderHint = " !" } }
},
details = new
{
description = taskToCreate.Description
},
// Note: 0 = "Not Started", 50 = "In Progress", 100 = "Completed"
percentComplete = taskToCreate.Status == "Completed" ? 100 : 0
};
var taskContent = new StringContent(
JsonConvert.SerializeObject(taskPayload),
Encoding.UTF8,
"application/json"
);
var postResponse = await httpClient.PostAsync(
$"{GraphApiEndpoint}/planner/tasks",
taskContent
);
var postResponseContent = await postResponse.Content.ReadAsStringAsync();
Console.WriteLine("POST Response: " + postResponseContent);
Now, you have a nice staircase in your productivity mansion.
Phase 4: Securing Your Mansion
Every mansion needs keys to secure it, right? In our case, the keys are the necessary securities that you need to add to your Azure App registration. Here's how to get those keys.
Setting Up Permissions
- Go to the Azure portal
- Head over to Azure Active Directory
- Under App Registrations, select the registered app you created earlier
- Click on API Permissions
Add the following permissions:
Group.Read.AllGroup.ReadWrite.AllTasks.ReadTasks.ReadWrite
Don't forget to grant admin consent for these permissions!
Creating a Client Secret
For an added layer of security, use Client Secret (think of it as a passcode for your mansion):
- Go to Certificates & Secrets under your app registration
- Click on New Client Secret
- Give it a description
- Set the expiry
- Click Add
Be sure to copy the value and keep it somewhere safe. You'll need this secret to make calls to the Graph API.
So, now you have the keys to your productivity mansion, and it's safer than ever!
A Microsoft 365 Planner Productivity Mansion Complete
Congratulations! With this last touch, you have successfully built your productivity mansion. I hope these strategies help you to expand and refine your productivity mansion with Microsoft 365 Planner. Enjoy the view from the top, my friend!
And with that, I hope you feel like you have all the tools, or shall we say, building materials, you need to elevate your Microsoft 365 Planner experience. Whether you're setting the foundation with Power Automate, opening windows to new tasks with Microsoft Forms, or building staircases to connect your SQL data to Planner with the Graph API, you're well-equipped to build a productivity mansion that's impressive, efficient, and truly yours.
Remember to keep your keys safe, and here's to countless successful projects in your magnificent productivity mansion. Happy planning, my friend!