Showing results for 
Search instead for 
Did you mean: 

access to assignee parameter in planner Tasks

Status: New
Level: Powered On
I've figured out a slighty better way to find who the task is assigned to. You don't have to hard code IDs to check against. It'll work for everybody. If Microsoft change how the data is arranged then this will stop working. Use this.
substring(string(items('Apply_to_each_2')?['assignments']), 2, 36)
Obviously you're going to have to change it to fit your circumstances, but what it does is simple. It takes the assignments objects which contains objects for every user that is assigned to that task. Then it turns it into a string to extract a substring containeing just the user's ID. It's not a solution to give you every assignee, but only the first. Then you can use Get user profile V2.
If you do this, you might want to do some error handling. If there's no assignee and you pass a bunch of strange characters to the user profile action it will get upset and fail your flow. In the end I used parallel branches so that i had a case if it failed and a case if it didn't. 
Level: Powered On

Hey Josh,


Can you show an example where this is not in a loop?


If I just have a flow that is trigger when a new planner task is created and I want to read the assigned user, how should that work?


I can see from your code the substring( , 2, 36) should return the first user, according to the properties documentation on


  "ca2a1df2-e36b-4987-9f6b-0ea462f4eb47": null,
  "4e98f8f1-bb03-4015-b8e0-19bb370949d8": { 
      "@odata.type": "microsoft.graph.plannerAssignment",
      "orderHint": "String"

But mine returns nothing when trying to implement.

Level: Powered On

Hi Charles_John,


Absolutely. It's almost exactly the same, but you'll get the assignee from the trigger rather than from a list of tasks. 




This is what you're after: 

substring(string(triggerBody()?['assignments']), 2, 36)




I suggest that you set two variables equal to your expression and input, and output them. You'll then be able to see whether your input or your expression is bad. ['assignments'] returns a list of the assignees, so yes, what i wrote will only pull the first assignee from the list.



{"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa":{ "@odata.type": "#microsoft.graph.plannerAssignment", "assignedDateTime": "2018-08-02T14:33:09.0383937Z", "orderHint": "", "assignedBy": { "user": { "displayName": null, "id": "bbbbbbbb-bbbb-bbb-bbbb-bbbbbbbbbbbb" } } }, "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa": { "@odata.type": "#microsoft.graph.plannerAssignment", "assignedDateTime": "2018-08-02T14:33:12.8850688Z", "orderHint": "", "assignedBy": { "user": { "displayName": null, "id": "bbbbbbbb-bbbb-bbb-bbbb-bbbbbbbbbbbb" } } }, "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa": { "@odata.type": "#microsoft.graph.plannerAssignment", "assignedDateTime": "2018-08-02T14:33:11.5119427Z", "orderHint": "", "assignedBy": { "user": { "displayName": null, "id": "bbbbbbbb-bbbb-bbb-bbbb-bbbbbbbbbbbb" } }



I'm not aware of a better way to get any assignee information or even a way to parse the list to extract every assignee. 


Good luck!

Level: Powered On

Got it working! I was incorrectly referring to my "Get_task_details" step and not the "triggerBody".


Your solution has also opened my eyes to the world of ms graph API documentation.$metadata#planner/tasks('EnterStringTaskIDhere')/details/$entity

Let's you search through everything.


Thank you JoshL

Level: Powered On

 Hi @JoshL


I have tried to apply your string to my flow.

I'd like to simply send a summary email for all actions with due date and assigned owner. I use the List Tasks Action.

I tried your formula and I get thrown an error saying 

"The template validation failed: 'The repetition action(s) 'Apply_to_each_2' referenced by 'inputs' in action 'Get_user_profile_(V2)' are not defined in the template.'."


could you take a look and see if you can tell where it fails?