web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Not getting properly t...
Power Automate
Unanswered

Not getting properly the category name from MS planner

(0) ShareShare
ReportReport
Posted on by 50

Hi guys,

 

I created an automated flow to get all the tasks from my MS Planner. I used MS Graph to do the whole process. My first step was to get the plan with the tasks using the query below:
https://graph.microsoft.com/v1.0/planner/plans/<plan-id>/tasks/

 

Once I did that, I parsed the result to JSON, using the 'Parse JSON', then I initialized the variables for each item I would like to use:

Donzera_0-1666679295428.png

Then for each tasks, the values below are set correctly:

Donzera_1-1666679737270.png

However, on the category, it doesn't add the correct name, it comes out like this: {"category1"}.

Does anyone know how to fix that? Or How to get the correct name for each category?

Thanks,

 

 

 



Categories:
  • grantjenkins Profile Picture
    11,063 Moderator on at

    I just did some testing with the Graph API in regard to getting Planner/Task Categories and it's really not nice what you get back to work with 😞

     

    The following endpoint will give you a full list of the custom categories you have on your Planner so might be able to match up with what you get back from the task endpoint.

     

    https://graph.microsoft.com/beta/planner/plans/<planId>/details

     

    You'll end up with something like the following:

    "categoryDescriptions": {
     "category1": "Cool",
     "category2": "Nice",
     "category3": "Awesome",
     "category4": null,
     "category5": null,
     "category6": null,
     "category7": null,
     "category8": null,
     "category9": null,
     "category10": null,
     "category11": null,
     "category12": null,
     "category13": null,
     "category14": null,
     "category15": null,
     "category16": null,
     "category17": null,
     "category18": null,
     "category19": null,
     "category20": null,
     "category21": null,
     "category22": null,
     "category23": null,
     "category24": null,
     "category25": null
    }

     

  • Donzera Profile Picture
    50 on at

    Thanks for replying.

    The output is not the best one, and I need to get those values and set in a field for a table in a Excel file.

  • grantjenkins Profile Picture
    11,063 Moderator on at

    Below will output either a simple array of categories, or a string of categories separated by a comma. Note that you would have an object called categoryDescriptions that would hold the raw data as per my previous post. I've just used a Compose to hold this data in my example.

     

    The full flow is below. I'll go into each of the actions.

    grantjenkins_0-1667876084769.png

     

    Compose hold the categories as what you'd get from your API response.

    {
     "categoryDescriptions": {
     "category1": "Cool",
     "category2": "Nice",
     "category3": "Awesome",
     "category4": null,
     "category5": null,
     "category6": null,
     "category7": null,
     "category8": null,
     "category9": null,
     "category10": null,
     "category11": null,
     "category12": null,
     "category13": null,
     "category14": null,
     "category15": null,
     "category16": null,
     "category17": null,
     "category18": null,
     "category19": null,
     "category20": null,
     "category21": null,
     "category22": null,
     "category23": null,
     "category24": null,
     "category25": null
     }
    }

     

    I then convert the JSON object to XML including the root element that's required for an XML document. The expression is:

    xml(json(concat('{"root": ', outputs('Compose')?['categoryDescriptions'], '}')))

    grantjenkins_1-1667876286358.png

     

    The output of this is a string of XML.

    grantjenkins_2-1667876352438.png

     

    We then use xpath to extract out the actual value of each category. The expression used is:

    xpath(outputs('Compose_XML'), '//root/*/text()')

    grantjenkins_3-1667876484049.png

     

    The output from this is:

    grantjenkins_4-1667876535745.png

     

    And finally, we can join the categories by comma (or similar).

    grantjenkins_5-1667876643647.png

     

    The output from this is:

    grantjenkins_6-1667876699010.png

     

    It's kind of crazy we have to do this sort of thing just to get our category values. Planner via the API or the PA actions both give us badly formed JSON objects unfortunately.

  • Donzera Profile Picture
    50 on at

    That's a nice solution, I would never get this, even if I tried for a whole month. How can I set the proper category that the task was designed for?

  • grantjenkins Profile Picture
    11,063 Moderator on at

    Can you share what the raw JSON output is when you get tasks using the Graph API? I can then see how to extract out those categories for you.

     

    I'm not entirely sure what you meant by your last question.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 307 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 289

#3
Henil Profile Picture

Henil 127

Last 30 days Overall leaderboard