Microsoft graph api Microsoft Team Graph API-请求中的绑定属性名称所有者无效
我目前在使用Graph API创建团队方面遇到了一些重大问题。我最初尝试创建基于组的团队,但是我今天发现,您现在可以创建一个团队,而无需先创建组,然后等待15分钟,然后从以下链接创建团队。这将使事情变得相当简单 我使用的是Microsoft.Graph SDK(8月26日发布的v3.12.0),因此使用SDK复制了http调用,如下所示Microsoft graph api Microsoft Team Graph API-请求中的绑定属性名称所有者无效,microsoft-graph-api,odata,microsoft-teams,Microsoft Graph Api,Odata,Microsoft Teams,我目前在使用Graph API创建团队方面遇到了一些重大问题。我最初尝试创建基于组的团队,但是我今天发现,您现在可以创建一个团队,而无需先创建组,然后等待15分钟,然后从以下链接创建团队。这将使事情变得相当简单 我使用的是Microsoft.Graph SDK(8月26日发布的v3.12.0),因此使用SDK复制了http调用,如下所示 var team = new Team { DisplayName = "My Group
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);
如果我拆下这条线
{"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."}]
如有任何建议,将不胜感激
谢谢,
Nick在v1.0中,所有者关系当前不存在,因此您必须使用beta端点。
POST:https://graph.microsoft.com/beta/teams
使用以下正文格式
{”template@odata.bind":"https://graph.microsoft.com/beta/teamsTemplates('standard'),“displayName”:“测试团队”,“描述”:“测试描述”owners@odata.bind":["https://graph.microsoft.com/v1.0/users/{user guid}“]}
注意:用户guid也应该是空的,即示例中没有括号和引号。这篇文章可以帮助您使用odata.bind的正确语法-
ErrorMessage : {"errors":[{"message":"A team owner must be provided when creating a team in application context."}]