2

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?

Ionela
  • 21
  • 1

3 Answers3

2

These are the documentation pages for adding tabs:

https://learn.microsoft.com/en-us/graph/api/channel-post-tabs?view=graph-rest-1.0 https://learn.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
Tarkan Sevilmis
  • 1,443
  • 7
  • 9
  • 1
    Also, please note that while this should work for now, this is not documented and the format here can be changed at a later time. We're looking for ways of allowing these tabs to created more consistently in the API and without needing specific URL knowledge. – Tarkan Sevilmis Mar 11 '22 at 20:55
  • it took weeks to find this, why is this not in the doc, why is entityId a random string in there – lunadir May 12 '23 at 09:42
0

The plans can be accessed to through this API:https://developer.microsoft.com/graph/graph-explorer?request=groups/%7Bid%7D/planner/plans&version=v1.0

Please refer this document:Top Planner API tasks

Mehtab Siddique
  • 556
  • 1
  • 2
  • 5
  • 1
    Yes, but I meant specifically the URL. I don't seem to be getting that in the response body and I wanted to find out if there is a possibility to get that. – Ionela Mar 11 '22 at 14:37
0

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
Tracy
  • 680
  • 7
  • 16