Building a Productivity Mansion with Microsoft 365 Planner

Building a Productivity Mansion: Microsoft 365 Planner

Chris Weiner Development Technologies, Programming, Tutorial Leave a Comment

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 Apps

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.

Open up Power Automate, click Create, select Instant Flow, name your Flow, choose Manually Trigger a Flow, and click Create.

To create a task, like setting the groundwork, add a new step. Click New Step, search for Planner, and 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.

Congratulations! 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.

Go ahead and create a form in Microsoft Forms. Then, jump back to Power Automate, click Create, and select Automated Cloud Flow. Under the trigger, when a new response is submitted, choose your form, and then 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, and 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

We can all agree, 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))
{
    var taskToCreate = await connection.QueryFirstOrDefaultAsync<TaskToCreate>("SELECT TOP X * FROM TasksToBeCreated"); // Map away boss no reason not to make it easier down the road
}

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
{
    planId = "<Your-Plan-Id>", //Don’t forget you can find this and your bucket id by opening the app in the web and using the URL call 😊
    bucketId = "<Your-Bucket-Id>",
    title = taskToCreate.Title,
    assignments = new Dictionary<string, object>
    {
        { user.Id, new { orderHint = " !" } }. //fun fact if we want the friendly name we need the transformation above otherwise we can use user.UserName
    },
    details = new
    {
        description = taskToCreate.Description
    },
    percentComplete = taskToCreate.Status == "Completed" ? 100 : 0 // Just a heads up… 0 is “Not Started” 50 is “In Progress” 100 is “Completed”
};

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.

First, you need to go to the Azure portal, then head over to Azure Active Directory. Under App Registrations, select the registered app you created earlier. Click on API Permissions. Here, you need to add the following permissions:

  • Group.Read.All
  • Group.ReadWrite.All
  • Tasks.Read
  • Tasks.ReadWrite

Don’t forget to grant admin consent for these permissions!

For an added layer of security, use Client Secret (think of it as a passcode for your mansion). To get it, go to Certificates & Secrets under your app registration, and click on New Client Secret. Give it a description, set the expiry, and 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!

Have an opinion or something to add? Drop a comment! And if you enjoyed this post and are hungry for more, check out the Keyhole Dev Blog.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments