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 […]