Skip to main content

Notifications

Community site session details

Community site session details

Session Id : Lixsvn9K8SMx+hrU0d0b5A
Power Automate - General Discussion
Answered

Getting Microsoft Planner Task Comments and Last Change Date

Like (0) ShareShare
ReportReport
Posted on 26 Feb 2024 16:40:41 by 6

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 

  • ritam.giri Profile Picture
    6 on 27 Feb 2024 at 02:10:14
    Re: Getting Microsoft Planner Task Comments and Last Change Date

    @SamLed 

    Awesome. I am going to try this out today. Letting you know.

  • Verified answer
    SamLed Profile Picture
    2,332 Moderator on 27 Feb 2024 at 00:24:04
    Re: Getting Microsoft Planner Task Comments and Last Change Date

    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)

    SamLed_0-1708986112279.png

     

    Once action added, it invites you to create a connection, enter "https://graph.microsoft.com" in both "Base resource URL" & "Microsoft Entra ID" fields:

    SamLed_1-1708986775779.png

     

    Sign in and you'll get the action ready to use:

    SamLed_2-1708986966442.png

     

     

    The flow to illustrate how to get task comments:

    • First get a task

    SamLed_4-1708989126294.png

     

    • Get task's plan (I renamed the "Invoke an HTTP request"):

    SamLed_5-1708989251875.png

    https://graph.microsoft.com/v1.0/planner/plans/@{outputs('Get_a_task')?['body/planId']} 

     

    • Get comments:

    SamLed_6-1708989392455.png

    https://graph.microsoft.com/v1.0/groups/@{body('Get_plan')?['owner']}/threads/@{body('Get_a_task')?['conversationThreadId']}/posts 

     

    • Select desired data (simplify json properties path for next actions):

    SamLed_7-1708989805922.png

    Frombody('Get_comments')?['value']

    HTMLitem()?['body']?['content']

    Createditem()?['createdDateTime']

    SenderNameitem()?['sender']?['emailAddress']?['name']

    SenderEmailitem()?['sender']?['emailAddress']?['address']

     

    At this point we've got these outputs:

    SamLed_11-1708991593142.png

     

    As you can see, comments have HTML embedded, so we need to clean it.

     

    • For each comment from select outputs:

    SamLed_10-1708991056557.png

    items('Apply_to_each')?['HTML']

     

    Outputs for one comment:

     

    SamLed_0-1709022626151.png

    I hilighted my comment, but you can see extra comment added by planner in thread, let's clean that:

     

    SamLed_13-1708991851892.png

    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:

    SamLed_1-1708992408578.png

    Comment: outputs('Extract_comment')

    Created: items('Apply_to_each')?['Created']

    SenderName: items('Apply_to_each')?['SenderName']

    SenderEmail: items('Apply_to_each')?['SenderEmail']

     

     

    SamLed_2-1708992715117.png

     

    Outputs:

    SamLed_4-1708992883653.png

    • Flow overall view:

    SamLed_6-1708992986744.png

     

    Enjoy 😉

    ______________________________________________________________

    If I have answered your question, please Accept the post as solution.
    If you like my response, please Thumbs Up.

  • wyattdave Profile Picture
    406 Super User 2025 Season 1 on 26 Feb 2024 at 18:45:51
    Re: Getting Microsoft Planner Task Comments and Last Change Date

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,731 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,075 Most Valuable Professional

Leaderboard
Loading started