Hello,
I'm currently working in developing a Cloud Flow that involves fetching details from Planner Tasks. One of the essential criteria is to obtain the Comments and Date Time of the last modifications made to the Planner Tasks.
Let me know if it is possible or not using Power Automate cloud flow.
Regards,
Ritam Giri
Awesome. I am going to try this out today. Letting you know.
Hi @RitamGiri,
Task comments are posts sent to plan's O365 group owner conversation. Each task has a dedicated thread.
To get them, you'll have to go through Graph API. I'll first show you how to use Graph API in Power Automate then I'll show you how to query for a task comments.
Graph API call using Power automate:
Use "Invoke an HTTP request" action (preauthorized version)
Once action added, it invites you to create a connection, enter "https://graph.microsoft.com" in both "Base resource URL" & "Microsoft Entra ID" fields:
Sign in and you'll get the action ready to use:
The flow to illustrate how to get task comments:
https://graph.microsoft.com/v1.0/planner/plans/@{outputs('Get_a_task')?['body/planId']}
https://graph.microsoft.com/v1.0/groups/@{body('Get_plan')?['owner']}/threads/@{body('Get_a_task')?['conversationThreadId']}/posts
From: body('Get_comments')?['value']
HTML: item()?['body']?['content']
Created: item()?['createdDateTime']
SenderName: item()?['sender']?['emailAddress']?['name']
SenderEmail: item()?['sender']?['emailAddress']?['address']
At this point we've got these outputs:
As you can see, comments have HTML embedded, so we need to clean it.
items('Apply_to_each')?['HTML']
Outputs for one comment:
I hilighted my comment, but you can see extra comment added by planner in thread, let's clean that:
join(reverse(skip(reverse(split(outputs('Html_to_text')?['body'], decodeUriComponent('%0A'))), 7)), decodeUriComponent('%0A'))
This expression splits outputs by '\n' (decodeUriComponent('%0A')), then reverse the resulting array, skips the 7 lines we don't want, reverse back to get comment lines in right order and finally join the array using '\n' to get a string.
Now, let's build a JSON object with all needed data:
Comment: outputs('Extract_comment')
Created: items('Apply_to_each')?['Created']
SenderName: items('Apply_to_each')?['SenderName']
SenderEmail: items('Apply_to_each')?['SenderEmail']
Outputs:
Enjoy 😉
If I have answered your question, please Accept the post as solution.
If you like my response, please Thumbs Up.
Im afraid I don't think it is currently possible. The api call to get the comments is:
https://tasks.office.com/37wcqv.onmicrosoft.com/GraphApiV1/GetConversationThreadPostsAsync?groupId={plannerGroupID}&conversationThreadId={conversationID}
But after checking SharePoint HTTP and Invoke an HTTP request it looks like none have the right permissions to use it.
WarrenBelz
146,731
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,075
Most Valuable Professional