Broken POST v1.0/teams Microsoft Graph API

Jarbas Horst 6 Reputation points MVP
2021-02-24T06:18:49.433+00:00

We use the Microsoft Graph API "POST teams/v1.0" to create Microsoft Teams team programmatically. This endpoint allows the creation of teams with predefined content such as settings, apps, channels, and tabs. However, we started facing on Feb 19th 2021 issues when trying to create a team with predefined tabs. The problem can be easily reproduced in Microsoft Graph Explorer. This is what the sample request I am using looks like. I used the sample provided in this documentation: https://learn.microsoft.com/en-us/graph/api/team-post?view=graph-rest-1.0&tabs=http

POST https://graph.microsoft.com/v1.0/teams  
  
{  
    "template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",  
    "visibility": "Private",  
    "displayName": "Sample Engineering Team",  
    "description": "This is a sample engineering team, used to showcase the range of properties supported by this API",  
    "channels": [  
        {  
            "displayName": "Announcements ��",  
            "isFavoriteByDefault": true,  
            "description": "This is a sample announcements channel that is favorited by default. Use this channel to make important team, product, and service announcements."  
        },  
        {  
            "displayName": "Training ��️",  
            "isFavoriteByDefault": true,  
            "description": "This is a sample training channel, that is favorited by default, and contains an example of pinned website and YouTube tabs.",  
            "tabs": [  
                {  
                    "teamsApp@odata.bind": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.web')",  
                    "displayName": "A Pinned Website",  
                    "configuration": {  
                        "contentUrl": "https://learn.microsoft.com/microsoftteams/microsoft-teams"  
                    }  
                },  
                {  
                    "teamsApp@odata.bind": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.youtube')",  
                    "displayName": "A Pinned YouTube Video",  
                    "configuration": {  
                        "contentUrl": "https://tabs.teams.microsoft.com/Youtube/Home/YoutubeTab?videoId=X8krAMdGvCQ",  
                        "websiteUrl": "https://www.youtube.com/watch?v=X8krAMdGvCQ"  
                    }  
                }  
            ]  
        },  
        {  
            "displayName": "Planning �� ",  
            "description": "This is a sample of a channel that is not favorited by default, these channels will appear in the more channels overflow menu.",  
            "isFavoriteByDefault": false  
        },  
        {  
            "displayName": "Issues and Feedback ��",  
            "description": "This is a sample of a channel that is not favorited by default, these channels will appear in the more channels overflow menu."  
        }  
    ],  
    "memberSettings": {  
        "allowCreateUpdateChannels": true,  
        "allowDeleteChannels": true,  
        "allowAddRemoveApps": true,  
        "allowCreateUpdateRemoveTabs": true,  
        "allowCreateUpdateRemoveConnectors": true  
    },  
    "guestSettings": {  
        "allowCreateUpdateChannels": false,  
        "allowDeleteChannels": false  
    },  
    "funSettings": {  
        "allowGiphy": true,  
        "giphyContentRating": "Moderate",  
        "allowStickersAndMemes": true,  
        "allowCustomMemes": true  
    },  
    "messagingSettings": {  
        "allowUserEditMessages": true,  
        "allowUserDeleteMessages": true,  
        "allowOwnerDeleteMessages": true,  
        "allowTeamMentions": true,  
        "allowChannelMentions": true  
    },  
    "discoverySettings": {  
        "showInTeamsSearchAndSuggestions": true  
    },  
    "installedApps": [  
        {  
            "teamsApp@odata.bind": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.vsts')"  
        },  
        {  
            "teamsApp@odata.bind": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('1542629c-01b3-4a6d-8f76-1938b779e48d')"  
        }  
    ]  
}  

This is what the error response includes:

{  
   "error":{  
      "code":"BadRequest",  
      "message":"Failed to execute Templates backend request CreateTeamFromTemplateRequest. Request Url: https://teams.microsoft.com/fabric/emea/templates/api/team, Request Method: POST, Response Status Code: BadRequest, Response Headers: Strict-Transport-Security: max-age=2592000x-operationid: 32e057e44a0d6f4db6573946dc15fcfdx-telemetryid: 00-32e057e44a0d6f4db6573946dc15fcfd-20ade0692a92db46-00X-MSEdge-Ref: Ref A: 8AECC984E039443AB1E83EF82CD13757 Ref B: DB3EDGE0719 Ref C: 2021-02-20T07:00:06ZDate: Sat, 20 Feb 2021 07:00:06 GMT, ErrorMessage : {\"errors\":[{\"message\":\"Tabs with duplicate DisplayName are not allowed.\",\"errorCode\":\"Unknown\"},{\"message\":\"'Channel Name' must not be empty.\",\"errorCode\":\"Unknown\"},{\"message\":\"'Channel Name' should not be empty.\",\"errorCode\":\"Unknown\"},{\"message\":\"'Channel Name' must not be empty.\",\"errorCode\":\"Unknown\"},{\"message\":\"'Channel Name' should not be empty.\",\"errorCode\":\"Unknown\"}],\"operationId\":\"32e057e44a0d6f4db6573946dc15fcfd\"}",  
      "innerError":{  
         "date":"2021-02-20T07:00:06",  
         "request-id":"7cb1cac4-9618-4ea6-baf0-9c415ad4a20c",  
         "client-request-id":"146e1b6f-49ed-91ed-82c1-1691a5ca21ad"  
      }  
   }  
}  

If the JSON object doesn't contain any tab configuration, the POST v1.0/teams endpoint works correctly. Here the test scenarios we covered:

  • POST beta/teams API
  • POST v1.0/teams API
  • delegated permission
  • application permission
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,592 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,846 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Mallipriya-MSFT 91 Reputation points
    2021-03-04T05:33:33.8+00:00

    To Create a team with multiple channels, installed apps, and pinned tabs using delegated permissions, you need to

    1. Call GET https://graph.microsoft.com/v1.0/appCatalogs/teamsApps
    2. Take the AppID of the respective app available in appcatalog that you want to install to the new Team
      being created. 3. Replace with the AppID in the request body of the request mentioned in the document.
      "teamsApp@odata.bind": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('{App ID}')" 4. The Team gets created with the respective channels and Apps.
    0 comments No comments

  2. Danstan Onyango 3,741 Reputation points Microsoft Employee
    2021-03-04T05:50:45.163+00:00

    @Jarbas Horst This issue was because of the tabs and was fixed earlier this week and should now work with your payload. Only note that that both name and displayName on the tabs will work but the documented property is displayName.

    See the details in this related thread

    0 comments No comments