cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate V
Advocate V

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

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=javasc...

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

10 REPLIES 10
Highlighted
Post Prodigy
Post Prodigy

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

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.

Highlighted
Advocate V
Advocate V

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

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.

Highlighted
Helper I
Helper I

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

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

Highlighted
Advocate V
Advocate V

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

Hi @murrah

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.

Highlighted
Helper I
Helper I

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

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

Highlighted
Regular Visitor

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

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

Highlighted
Advocate V
Advocate V

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

Hi @gburdon

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-porta...).

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.

Highlighted
Regular Visitor

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

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.

Highlighted
Advocate V
Advocate V

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

Hi @gburdon 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.

Highlighted
Regular Visitor

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

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

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Users online (7,812)