Edit – September 2023: With the deprecation of the ‘Send an HTTP Request’ V1 action, the below method no longer works. Please check the following post for an alternative solution: Using the ‘HTTP with Azure AD’ connector in Power Automate to create Planner Plans and add them as Teams tabs
Some time ago I blogged about using Power Automate to create Planner Plans and recently I got a query on that post about adding the created plan to the General channel of the related Team as a tab.
The procedure to add a Planner plan as a tab using Graph is not documented by Microsoft, but by investigating manually added examples (using Graph Explorer to retrieve the tab content format), we can figure out how the structure of a Planner tab works. Bear in mind this is not a documented procedure and may break if the tab setup structure change later.
Find your Team ID (Microsoft 365 Group ID)
Find the ID of the Group/Team (easily found under Groups in the Azure portal) you want to create the planner plan and add it as a Tab:
It will be needed in the Flow so we can create the Plan under it and also set up the tab in the related Team.
Creating the Flow
For demo purposes, let’s create a manually Triggered flow. This can be tweaked so your Flow is part of a bigger automation piece, so let’s add the Plan name input also as a variable, making the reference able to be changed easily if needed. We also need another variable to store the Tab Name (in this case we simply prepend ‘Planner – ‘ to the Plan name) and the Team ID (which you got from Azure AD):
Retrieving the Channel ID
Next, we need to retrieve the ID of the General channel. To do it we list all channels from the Team we chose, run a filter action on top of the list and save the first result in a variable:
The formula for the first entry ID (considering a renamed Filter array action as above):
first(body('Filter_array_-_Channels'))['Id']
Creating the Plan and parsing the created plan data
To create the plan we can use the ‘Send an HTTP Request’ action from the Office 356 connectors and run a call to Microsoft Graph, then parse the response using the ‘Parse JSON’ action as below:
The below schema can be used to parse the Request Body:
{
"type": "object",
"properties": {
"@@odata.context": {
"type": "string"
},
"@@odata.etag": {
"type": "string"
},
"createdDateTime": {
"type": "string"
},
"owner": {
"type": "string"
},
"title": {
"type": "string"
},
"id": {
"type": "string",
"description": "The Plan ID"
},
"createdBy": {
"type": "object",
"properties": {
"user": {
"type": "object",
"properties": {
"displayName": {},
"id": {
"type": "string"
}
}
},
"application": {
"type": "object",
"properties": {
"displayName": {},
"id": {
"type": "string"
}
}
}
}
}
}
}
Save the plan ID in a variable as below:
Adding it as a Tab
The last step is to call a POST request in the Graph endpoint related to the Channel tabs with the Planner configuration as body, as below:
This will add Planner as a tab to the General channel of the Team, and specify the Plan to use in that tab.
Given that all the variables in the flow respect the names of the sample pictures above, the below code can be copied and pasted into your ‘Send an HTTP request’ action’s body. This is what instructs teams what are the configuration details for the Planner tab:
{
"displayName": "@{variables('TabName')}",
"teamsApp@odata.bind": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/com.microsoft.teamspace.tab.planner",
"configuration": {
"entityId": "@{variables('ChannelID')}",
"contentUrl": "https://tasks.teams.microsoft.com/teamsui/{tid}/Home/PlannerFrame?page=7&auth_pvr=OrgId&auth_upn={userPrincipalName}&groupId={groupId}&planId=@{variables('PlanID')}&channelId={channelId}&entityId={entityId}&tid={tid}&userObjectId={userObjectId}&subEntityId={subEntityId}&sessionId={sessionId}&theme={theme}&mkt={locale}&ringId={ringId}&PlannerRouteHint={tid}",
"removeUrl": "https://tasks.teams.microsoft.com/teamsui/{tid}/Home/PlannerFrame?page=13&auth_pvr=OrgId&auth_upn={userPrincipalName}&groupId={groupId}&planId=@{variables('PlanID')}&channelId={channelId}&entityId={entityId}&tid={tid}&userObjectId={userObjectId}&subEntityId={subEntityId}&sessionId={sessionId}&theme={theme}&mkt={locale}&ringId={ringId}&PlannerRouteHint={tid}",
"websiteUrl": "https://tasks.office.com/{tid}/Home/PlanViews/@{variables('PlanID')}?Type=PlanLink&Channel=TeamsTab"
}
}
Results
After running this Flow, a Plan will be added to the General tab of the specified team:
You can download the working flow from my Github samples repository if you prefer.
References
[…] Source link […]
Hey there, I really like post!
I tried out your solution and it works fine most of the time.
However sometimes I receive a 403 Forbidden Code from the ‘Create Plan’ HTTP request.
Do you know any solutions to this?
Do you have the right permissions in the M365 group you are trying to create the plan?
This is excellent thank you very much for sharing. Works like a charm. Is it possible to create the plan from one of the pre-built Microsoft templates or a custom one?
Hello,
Not that I am aware of, using Graph we can create Plans from scratch only. You could use other actions to maybe get the buckets and etc from an existing plan built using a template and replicate the properties.
Good Day!
I fought this for a long period. For some reason I only have Send an HTTP request V2 or Send an HTTP Request that is both groups and email. The endpoints were not working. Search as I may, I could not find the one you used.
I downloaded yours from Github and was able to configure and make it work flawlessly. Do you know if Microsoft changed something and removed the original one? If so, is there a way to re-install it? I have made some work with the new clipboard but fear ultimately losing it.
Also, have you tried v2?
Hello!
Unfortunately the V1 has been deprecated:
https://learn.microsoft.com/en-us/connectors/office365groups/?WT.mc_id=M365-MVP-5004644#send-an-http-request-%5Bdeprecated%5D
The sample will work however we cannot know until when…
You could use the connector ‘HTTP with Azure AD’ instead to call Graph.
V2 works but the range of endpoints is mostly limited to the connectors they relate (for example, you can only use the /groups enpoint for the HTTP action below Office 365 groups)
Hello,
I followed everything but when I try to run it for Send an HTTP request – Create Plan I get an BadRequest. It says that the link is obsolete. Do you know what could be used instead?
You could use the HTTP with Azure AD connector to call Microsoft Graph and create Planner plans. Unfortunately the V1 action for ‘Send an HTTP request’ under Office 365 groups has been deprecated:
https://learn.microsoft.com/en-us/connectors/office365groups/?WT.mc_id=M365-MVP-5004644#send-an-http-request-%5Bdeprecated%5D
Getting this on the step to create the plan. URI path is not a valid Graph endpoint, path is neither absolute nor relative or resource/object is not supported for this connector. Resources: groups. Uri: https://graph.microsoft.com/v1.0/planner/plans
With the deprecation of the ‘Send an HTTP Request’ V1 action, the below method no longer works. Please check the following post for an alternative solution:
https://michelcarlo.com/2023/09/01/using-the-http-with-azure-ad-connector-in-power-automate-to-create-planner-plans-and-add-them-as-teams-tabs/
Hi there,
I used your code for adding a planner tab to a teams channel, it was working properly. But recently i stopped working.
I receive this error info:
“Creating or updating tab configuration for app ‘com.microsoft.teamspace.tab.planner’ is not supported.”
I found this online:
https://answers.microsoft.com/en-us/msteams/forum/all/problem-created-by-microsoft-in-last-days-with/1a057fe6-ca1a-4c9e-b8f2-6a672785afa9
Are you experiencing the same issue since the planner update and do you have a solution?
Regards,
Robert
Hello, thanks for your feedback😊
As reported by a few readers, the piece to add the plan as Tab does not work anymore, I will be posting updates if I find an alternative solution.