Planner Plan URL or creating a Planner Tab in Teams

Viewed 366

I've been trying to create a plan using the Graph REST API for .Net and Microsoft Planner. Following the provided documentation, I was able to create a plan. However, I've seen that after creating it, no URL in order to access that plan is provided.

I was wondering if there was a way of getting or constructing this URL having the planId.

Following this, I also want to link the created Plan to a Tab in Microsoft Plan, but could not find anything useful in the documentation. Is there even a way to create a Planner Tab in Ms Teams using the Graph API?

3 Answers

These are the documentation pages for adding tabs:

https://docs.microsoft.com/en-us/graph/api/channel-post-tabs?view=graph-rest-1.0 https://docs.microsoft.com/en-us/graph/teams-configuring-builtin-tabs

The URL for the Planner Tab page is as follows. You'll need to put your plan id there, but other variables in curly braces are part of the URL as variables, and get filled in by Teams when someone is viewing the tab.

https://tasks.teams.microsoft.com/teamsui/{tid}/Home/PlannerFrame?page=7&auth_pvr=OrgId&auth_upn={userPrincipalName}&groupId={groupId}&planId=<YourPlanId>&channelId={channelId}&entityId={entityId}&tid={tid}&userObjectId={userObjectId}&subEntityId={subEntityId}&sessionId={sessionId}&theme={theme}&mkt={locale}&ringId={ringId}&PlannerRouteHint={tid}&tabVersion=20200228.1_s

The full request looks like:

{
  "displayName": "<Name of the tab>",
  "teamsApp@odata.bind" :  "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/com.microsoft.teamspace.tab.planner",
  "configuration":{
      "entityId": "<combined channel and plan id>",
      "contentUrl": "https://tasks.teams.microsoft.com/teamsui/{tid}/Home/PlannerFrame?page=7&auth_pvr=OrgId&auth_upn={userPrincipalName}&groupId={groupId}&planId=<Your plan Id>&channelId={channelId}&entityId={entityId}&tid={tid}&userObjectId={userObjectId}&subEntityId={subEntityId}&sessionId={sessionId}&theme={theme}&mkt={locale}&ringId={ringId}&PlannerRouteHint={tid}&tabVersion=20200228.1_s"
  }
}

3 values need to be replaced there, the display name, the entity id and the plan id in the URL. The entity id value looks like

tt.c_<channel id>_p_<plan id>
For example for Channel ID = ABC, and Plan ID = 123, you'd get literal string
tt.c_ABC_p_123

You should only need the Planner Id and Channel Id to create a Planner tab in Teams.

Here is my complete request body:

{
  "displayName": "<Name of the tab>",
  "teamsApp@odata.bind" :  "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/com.microsoft.teamspace.tab.planner",
  "configuration":{
      "entityId": "tt.c_<Channel Id>_p_<Plan Id>",
      "contentUrl": "https://tasks.teams.microsoft.com/teamsui/{tid}/Home/PlannerFrame?page=7&auth_pvr=OrgId&auth_upn={userPrincipalName}&groupId={groupId}&planId=<Plan Id>&channelId={channelId}&entityId={entityId}&tid={tid}&userObjectId={userObjectId}&subEntityId={subEntityId}&sessionId={sessionId}&theme={theme}&mkt={locale}&ringId={ringId}&PlannerRouteHint={tid}&tabVersion=20200228.1_s",
      "removeUrl": "https://tasks.teams.microsoft.com/teamsui/{tid}/Home/PlannerFrame?page=13&auth_pvr=OrgId&auth_upn={userPrincipalName}&groupId={groupId}&planId=<Plan Id>&channelId={channelId}&entityId={entityId}&tid={tid}&userObjectId={userObjectId}&subEntityId={subEntityId}&sessionId={sessionId}&theme={theme}&mkt={locale}&ringId={ringId}&PlannerRouteHint={tid}&tabVersion=20200228.1_s",
      "websiteUrl": "https://tasks.office.com/d3ee719b-9e5c-478b-87c9-c4ffbfd27c96/Home/PlanViews/<Plan Id>?Type=PlanLink&Channel=TeamsTab"   
  }
}

The following attributes need values replaced:

  • displayName: Tab Title
  • entityId: Channel Id & Plan Id
  • contentUrl: Plan Id
  • removeUrl: Plan Id
  • websiteUrl: Plan Id
Related