Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Triggers
  • Resources
  • ABOUT ME
  • Get help with your flow
Menu

How to store Planner assigned users in SharePoint with Power Automate

Posted on September 8, 2021September 8, 2021 by Tom

“How can I use Power Automate flow to create a SharePoint list item including the information to which users is the Planner task assigned?”


Exporting Planner task assigned users to Excel file was already covered, but what about a SharePoint list? The problem is still the same – the output of the ‘List tasks’ action. If it returned assigned user email addresses, you could easily update them to the SharePoint item. But it doesn’t. It’ll return user id with a bunch of useless information. If you want to export the tasks into a SharePoint list, you must turn the user id into email first, and only then create the item.

The basics of this solution were already described in other posts which I’ll reference.

Convert the user id into email address

As already mentioned, the first step is to turn the user id into email address. The approach is similar as when exporting users from Planner tasks to an Excel file. If you follow that post, you’ll get to the chapter “Fill the mapping table”. The original post is creating a mapping table with user names, but to update them in SharePoint item you’ll need user emails. To achieve that you want to store the Mail property, not the DisplayName in the variable.

addProperty(variables('var_mappingTable'),item(),outputs('Get_user_profile_(V2)_-_get_user_by_userId')?['body/Mail'])
Power Automate Planner assigned users SharePoint

The mapping table will then have a format as below.

Use the mapping table

The second difference will be when updating / creating the SharePoint item. The goal of the Excel article was to create a readable string with user names. But to create a SharePoint item you must follow the desired format.

[
   { "Claims": "user1@company.com" },
   { "Claims": "user2@company.com" }
]

Therefore, when you store the user information in a variable, don’t save just the expression (user email). Append the whole key-value pair, including the brackets.

{ "Claims": "variables('var_mappingTable')?[item()]" }

Then just switch to the ‘Input an array’ option and use the variable to store the assigned users to SharePoint.

And don’t forget to empty the variable after each created item.

Full flow diagram

Only the actions that are different from the export to Excel flow are expanded.

Power Automate Planner assigned users SharePoint

Summary

When you export Planner tasks with Power Automate, the assigned users can cause a headache, and not only if you store them in a SharePoint list. You must take the user id, convert it to more useful user information, and then use it to export the task. But the good news is that the processing is very similar, no matter where you export the task. It can be an Excel file, it can be a SharePoint list, or just a simple email with HTML table.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

1 thought on “How to store Planner assigned users in SharePoint with Power Automate”

  1. Garry says:
    May 17, 2023 at 1:01 am

    Hi,

    Thanks so much for your extensive work to help others.

    I’ve tried the above but I’m getting the following error message:

    Flow save failed with code ‘InvalidTemplate’ and message ‘The template validation failed: ‘The action(s) ‘Get_user_profile_(V2)_-_get_user_by_userId’ referenced by ‘inputs’ in action ‘Compose_-_fill_mapping_table’ are not defined in the template.’.’

    Can you give me a steer?

    I’m very inexperienced so it’s probably something obvious no doubt.

    Thanks,

    Garry

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Do you know what to do, but not how to do it?

Get The Ultimate Power Automate expressions cheat sheet and translate your thoughts into flows with ease!


There's also the HTTP requests to SharePoint cheat sheet to help you overcome limitations of some standard actions!

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with 1000s of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2023 Let's POWER Automate | Theme by SuperbThemes