使用Microsoft Graph Api创建团队的问题

时间:2020-01-23 22:04:11

标签: microsoft-teams bad-gateway

使用Microsoft Graph Api创建团队时遇到问题。我可以获取/创建组,但是当我尝试获取/创建团队时,会出现错误。我使用的是邮递员,并且该组具有所有者和成员,就像MS的文档一样,也具有它要求组的许可。如果有人可以帮助我,导致我到处寻找相同的错误,但没有找到它。

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

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

身体是

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

我总是遇到相同的错误

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

1 个答案:

答案 0 :(得分:1)

为此Graph API docs,您没有调用正确的端点来创建新团队。应该是

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

和类似于

的有效载荷
Content-Type: application/json
{
  "template@odata.bind": "https://graph.microsoft.com/beta/teamsTemplates('standard')",
  "displayName": "My Sample Team",
  "description": "My Sample Team’s Description",
  "owners@odata.bind": [
    "https://graph.microsoft.com/beta/users('userId')"
  ]
}

请注意,根据文档的不同,无论您使用委托还是应用程序许可。