DanteGz
DanteGz

Reputation: 11

Problem with create team with Microsoft Graph Api

I have a problem with creating teams using the Microsoft Graph Api. I can get/create groups but when I try to get/create teams I get an error. I'm using postman and the group has owners and members, just as the documentation of MS, also has the permissitions it asks for groups. If somebody can help me, cause I look everywhere for a same error but no found it.

PUT https://graph.microsoft.com/v1.0/groups/{id}/team

Headers: Authorization: bearer token and content-type: json

Body is

{  
  "memberSettings": {
    "allowCreateUpdateChannels": true
  },
  "messagingSettings": {
    "allowUserEditMessages": true,
    "allowUserDeleteMessages": true
  },
  "funSettings": {
    "allowGiphy": true,
    "giphyContentRating": "strict"
  }
}

I always get the same error

{
  "error": {
    "code": "BadGateway",
    "message": "Failed to execute backend request.",
    "innerError": {
      "request-id": "45eeba8a-9d35-45e8-b42e-c60da7a47dde",
      "date": "2020-01-23T21:55:44"
    }
  }
}

Upvotes: 1

Views: 2436

Answers (1)

Hilton Giesenow
Hilton Giesenow

Reputation: 10804

According to the Graph API docs for this, you're not calling the correct endpoint to create a new Team. It should be

POST https://graph.microsoft.com/beta/teams

and a payload similar to

Content-Type: application/json
{
  "[email protected]": "https://graph.microsoft.com/beta/teamsTemplates('standard')",
  "displayName": "My Sample Team",
  "description": "My Sample Team’s Description",
  "[email protected]": [
    "https://graph.microsoft.com/beta/users('userId')"
  ]
}

Note that it's slightly different, as per the docs, whether you're using delegated versus application permissons.

Upvotes: 1

Related Questions