[英]Create a teams team error when using Microsoft graph api
I just follow this official document to excuse create a team.我只是按照这个官方文件来找借口创建一个团队。 Create team I also using the client credential flow and apply all the permissions advised.
创建团队我也使用客户端凭据流并应用建议的所有权限。 In Postman, I used this message to call
在 Postman 中,我使用此消息调用
{
"template@odata.bind":"https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
"displayName":"My Sample Team",
"description":"My Sample Team’s Description",
"members":[
{
"@odata.type":"#microsoft.graph.aadUserConversationMember",
"roles":[
"owner"
],
"userId":"xxxxx-61d8-43db-94f5-81374122dc7e"
}
]
}
but unfortunately will get such error message, I'm fully confused on this unknown Error但不幸的是会收到这样的错误信息,我对这个未知的错误感到非常困惑
{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"date": "2020-11-02T05:32:08",
"request-id": "2955c466-f25f-42f5-ba89-4a522c428b70",
"client-request-id": "2955c466-f25f-42f5-ba89-4a522c428b70"
}
}
}
I also tried to execute it in C# code我也尝试在 C# 代码中执行它
var team = new Team
{
DisplayName = "My Sample Team558",
Description = "My Sample Team’s Description558",
Members = new TeamMembersCollectionPage() {
new AadUserConversationMember
{
Roles = new List<String>()
{
"owner"
},
UserId = "9xxxxxc9-f062-48e2-8ced-22xxxxx6dfce"
}
},
AdditionalData = new Dictionary<string, object>()
{
{"template@odata.bind", "https://graph.microsoft.com/v1.0/teamsTemplates('standard')"}
}
};
var result = await graphServiceClient.Teams
.Request()
.AddAsync(team);
This async call will be executed successfully and a new teams team will be also created, but the result return null, that means I could not get the team id from the result.这个异步调用会成功执行,也会创建一个新的团队团队,但结果返回空,这意味着我无法从结果中获取团队 id。 I could not go to the next step, such as add a new channel etc. I'm using
Microsoft.Graph v3.18.0.0
in my C# code。我无法进行下一步,例如添加新频道等。我在我的 C# 代码中使用
Microsoft.Graph v3.18.0.0
。
I can easily reproduce your problem.我可以轻松重现您的问题。 The cause of this error may be that you did not grant the necessary permissions or did not grant the admin consent for this permission.
此错误的原因可能是您未授予必要的权限或未授予管理员同意此权限。
Therefore, you need to check that you have granted the necessary application permissions and Permission is granted to the admin consent .因此,您需要检查您是否已授予必要的应用程序权限,并且 Permission 已授予管理员同意。
code:代码:
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var team = new Team
{
DisplayName = "My Sample Team",
Description = "My Sample Team’s Description",
AdditionalData = new Dictionary<string, object>()
{
{"template@odata.bind", "https://graph.microsoft.com/v1.0/teamsTemplates('standard')"}
}
};
await graphClient.Teams
.Request()
.AddAsync(team);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.