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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Updating a Microsoft P...
Power Automate
Unanswered

Updating a Microsoft Planner task using Microsoft Flow (Office Graph API)

(0) ShareShare
ReportReport
Posted on by 329

Dear all,

 

I am building a Microsoft Flow workflow that automatically:

  • creates a bucket in Microsoft Planner
  • adds several tasks to the buckets
  • updates the tasks with a checklist and other details

I am trying to accomplish this using HTTP calls. I use this Microsoft Doc as a reference: https://docs.microsoft.com/en-us/graph/api/plannertaskdetails-update?view=graph-rest-1.0&tabs=javascript

I must say, I am successfully able to do this manually using Postman. 
But I can't seem to figure out how to: Obtain an authorization code from within Microsoft Flow

 

I can do this manually using my internet browser, no problem. I simply browse to the following URL:

https://login.microsoftonline.com/{tenantname}.onmicrosoft.com/oauth2/v2.0/authorize?client_id={AzureAppRegistrationID}

&response_type=code&redirect_uri={MyRedirectURI}&response_mode=query&scope=offline_access%20user.read%20mail.read&state=12345

 

I get the code, which I will use to obtain an Access Token.

The point is: how do I obtain this authorization code from within my Microsoft Flow?

Another question I am having in respect to this Microsoft Flow step: what Redirect URI should I configure in this scenario, so that Microsoft Flow picks up the response (authorization code automatically)?

 

Thanks a lot for all help provided!

 

Kind regards,

Joost

Categories:
I have the same question (0)
  • v-lin-msft Profile Picture
    728 on at

    Hi @jvdlinden ,

     

    Could you please share a full screenshot of your flow’s configuration?

     

    About how to get the access token in flow, you can refer to this blog:

    Microsoft-Flow-Community-Blog/Extend-Microsoft-Flow-with-the-Microsoft-Graph-and-0-code

     

    And about your second question:" what Redirect URI should I configure in this scenario, so that Microsoft Flow picks up the response (authorization code automatically)", you can use a variable to store the authorization code.

     

    Best Regards,

    Community Support Team _ Lin Tu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • jvdlinden Profile Picture
    329 on at

    Hi @v-lin-msft ,

    I must say it is quite an extensive workflow. And by the way, most of the Flow steps have a Dutch title.config.png

     

    Basically, I am creating a new Planner bucket using OOTB Flow functionality.

    Then, I put the name of the bucket in a variable.

    Eventually the Flow will be retrieving al list of buckets so I can perform a condition on it.

    Then I create a Planner task to the bucket matching the condition, and then I would like to add several checklist items to it using the HTTP PATCH command. But it would require me to retrieve the eTAG value, and this is the first error that is shown in the flow (screenshot). The Parse JSON would need to parse the value so I can use it in my PATCH command.

     

    Hope this helps.

  • Community Power Platform Member Profile Picture
    on at

    Hi Joost. Did you figure out how to do the PATCH with etag and implement the right auth token? I want to do a similar update to a Task to move it from one bucket to another. Similar issue.

     

    Thanks,

    Murray

  • jvdlinden Profile Picture
    329 on at

    Hi @Anonymous, 

    Please find a couple of screenshots below for your convenience. In my case I am starting from scratch, creating the Planner task and adding details to it (checklist items), I hope this helps you build up yours. I have excluded the most obvious steps, declaring variables etc.

     

    • Retrieve Access Token

    2019-11-26 14_58_19-Microsoft Edge.png

    • Parse Access Token (JSON)

    2019-11-26 14_59_17-Microsoft Edge.png

     

    Copy of the Schema:

    {
        "properties": {
            "access_token": {
                "type": "string"
            },
            "expires_in": {
                "type": "integer"
            },
            "ext_expires_in": {
                "type": "integer"
            },
            "refresh_token": {
                "type": "string"
            },
            "token_type": {
                "type": "string"
            }
        },
        "type": "object"
    }
    • Create Planner task

    2019-11-26 15_00_08-Microsoft Edge.png

    • Retrieve eTAG value of Planner task

    2019-11-26 15_00_52-Microsoft Edge.png

    Make sure to include a space between token_type and access_token.

     

    • Parse eTAG value Planner task (JSON)

    2019-11-26 15_01_53-Microsoft Edge.png

    • Add additional Planner task details

    2019-11-26 15_02_32-Microsoft Edge.png

    Make sure to include a space between token_type and access_token.

     

    Hope this helps!

    If you need more info just let me know.

  • Community Power Platform Member Profile Picture
    on at

    Hi @jvdlinden 

    Thanks so much for your detailed reply and my apologies for a slow acknowledgment. I will work up my test using your guide above over the next few days and let you know how I go with it.

    Much appreciated,

    Go well,

    Murray

  • Community Power Platform Member Profile Picture
    on at

    Hi @jvdlinden,

     

    Trying to do something similar in planner and have found this really useful.  Can you give more details about the account you have setup to retrieve the access token?  Permissions etc.

    Thanks again

  • jvdlinden Profile Picture
    329 on at

    Hi @Anonymous, 

    Sure, no problem.

    I went to Azure Active Directory and created a new 'app registration' (https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal).

    Give it a name that suits your scenario.

    Open the App registration and head to the "Certificates & secrets" section to generate a new "client secret". You will be able to copy this secret once. As the name suggests, be very careful with this secret 'code', treat it as a password.

    Next, make sure you assign the appropriate (necessary) API permission(s) that fits your purpose. You'll find that in the "API permissions" section within the App registration. In my case I had added these permissions:

    API permissions.png

    Each Microsoft Docs article will describe the required permissions to complete the task. Example: https://docs.microsoft.com/en-us/graph/api/planner-post-tasks?view=graph-rest-1.0&tabs=http

    To fully configure the API permissions, you will need to provide admin consent, so sign in using an Admin-account with sufficient privileges to consent.

    Finally you will need to find the Client ID and Tenant ID in the Overview section within the App registration to further configure your flow and include them in your HTTP actions as you could have seen in my examples.

    Hope this helps.

  • Community Power Platform Member Profile Picture
    on at

    Hi @jvdlinden,

     

    Yes, very helpful, thank you.  And what user account are you using in the Token Access Post Request?

    TokenRequest_UserAccount_ScreenShot.jpg

     

    I've tried using a Global Admin account but MFA is enabled so doesn't work.

  • jvdlinden Profile Picture
    329 on at

    Hi @Anonymous I am using an Office 365 user account: cloud-only, no Administrator access (no Admin role) and without MFA.

    I think MFA is your issue there.

  • Community Power Platform Member Profile Picture
    on at

    @jvdlinden, thanks, i'll give that a go.
    Kind regards.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard