Microsoft Teams Graph API - 请求中的绑定 属性 名称所有者无效
Microsoft Teams Graph API - Invalid bind property name owners in request
我目前在从 Graph API 创建团队时遇到了重大问题。我最初尝试基于组创建团队,但我今天发现您现在可以创建一个团队,而无需先创建一个组,然后等待 15 分钟,然后从以下 link 创建团队。这将使事情变得简单得多。
https://docs.microsoft.com/en-us/graph/api/team-post?view=graph-rest-1.0
我正在使用 Microsoft.Graph SDK(v3.12.0 于 8 月 26 日发布),因此使用 SDK 复制了 http 调用,如下所示。
var team = new Team
{
DisplayName = "My Group Name",
Description = "My Group Description",
AdditionalData = new Dictionary<string, object>()
{
{"template@odata.bind", "https://graph.microsoft.com/v1.0/teamsTemplates('educationClass')"},
{"owners@odata.bind", $"[\"https://graph.microsoft.com/v1.0/users('{usersGuid}')\"]"}
},
};
var response = await _graphClient.Teams
.Request()
.AddAsync(team);
上面的代码给出了一个:
[16:14:01 ERR] An unhandled exception has occurred while executing the request.
Status Code: BadRequest
Microsoft.Graph.ServiceException: Code: BadRequest
Message: Invalid bind property name owners in request.
如果我删除行
{"owners@odata.bind", $"[\"https://graph.microsoft.com/v1.0/users('{usersGuid}')\"]"}
从代码中我得到以下信息:
ErrorMessage : {"errors":[{"message":"A team owner must be provided when creating a team in application context."}]
如有任何建议,我们将不胜感激。
谢谢,
尼克
在 v1.0 中,当前不存在所有者关系,因此您必须使用 beta 端点。
POST: https://graph.microsoft.com/beta/teams
正文格式如下
{ "template@odata.bind":"https://graph.microsoft.com/beta/teamsTemplates('standard')", "displayName":"Test Team", "description":"Test description", "owners@odata.bind":["https://graph.microsoft.com/v1.0/users/{user guid}"] }
注意:用户 guid 也应该是空的,即在您的示例中没有括号和引号。
我目前在从 Graph API 创建团队时遇到了重大问题。我最初尝试基于组创建团队,但我今天发现您现在可以创建一个团队,而无需先创建一个组,然后等待 15 分钟,然后从以下 link 创建团队。这将使事情变得简单得多。
https://docs.microsoft.com/en-us/graph/api/team-post?view=graph-rest-1.0
我正在使用 Microsoft.Graph SDK(v3.12.0 于 8 月 26 日发布),因此使用 SDK 复制了 http 调用,如下所示。
var team = new Team
{
DisplayName = "My Group Name",
Description = "My Group Description",
AdditionalData = new Dictionary<string, object>()
{
{"template@odata.bind", "https://graph.microsoft.com/v1.0/teamsTemplates('educationClass')"},
{"owners@odata.bind", $"[\"https://graph.microsoft.com/v1.0/users('{usersGuid}')\"]"}
},
};
var response = await _graphClient.Teams
.Request()
.AddAsync(team);
上面的代码给出了一个:
[16:14:01 ERR] An unhandled exception has occurred while executing the request.
Status Code: BadRequest
Microsoft.Graph.ServiceException: Code: BadRequest
Message: Invalid bind property name owners in request.
如果我删除行
{"owners@odata.bind", $"[\"https://graph.microsoft.com/v1.0/users('{usersGuid}')\"]"}
从代码中我得到以下信息:
ErrorMessage : {"errors":[{"message":"A team owner must be provided when creating a team in application context."}]
如有任何建议,我们将不胜感激。
谢谢, 尼克
在 v1.0 中,当前不存在所有者关系,因此您必须使用 beta 端点。
POST: https://graph.microsoft.com/beta/teams
正文格式如下
{ "template@odata.bind":"https://graph.microsoft.com/beta/teamsTemplates('standard')", "displayName":"Test Team", "description":"Test description", "owners@odata.bind":["https://graph.microsoft.com/v1.0/users/{user guid}"] }
注意:用户 guid 也应该是空的,即在您的示例中没有括号和引号。