从组创建团队失败并出现异常

Create team from group fails with exception

我通过 C# graph-api sdk 在 Microsoft Teams (from groups as documented here) 中创建了团队,没有任何问题 - 一切正常。

但是突然间这不再起作用了。我总是会在 return await graphServiceClient.Teams.Request().AddAsync(team);:

行得到以下异常

Message: Failed to execute Templates backend request CreateTeamFromGroupWithTemplateRequest. Request Url: https://teams.microsoft.com/fabric/emea/templates/api/groups/theGroupId/team, Request Method: PUT,

还有:

Team Visibility can not be specified as it is inherited from the group.

我知道如果从 Microsoft 文档中所述的组创建团队,则不能设置可见性 属性:

The team that's created will always inherit from the group's display name, visibility, specialization, and members. Therefore, when making this call with the group@odata.bind property, the inclusion of team displayName, visibility, specialization, or members@odata.bind properties will return an error.

但是下面当前使用的代码表明我没有设置任何禁止的属性 - 而且这段代码在过去几天也有效:

    private async Task<Team> CreateTeamFromGroup(string groupId)
    {
        var graphServiceClient = [...]

        var groupResourceLink = $"https://graph.microsoft.com/v1.0/groups('{groupId}')";
        var team = new Team
        {
            AdditionalData = new Dictionary<string, object>()
            {
                { "template@odata.bind", "https://graph.microsoft.com/beta/teamsTemplates('standard')" },
                { "group@odata.bind", groupResourceLink }
            },
            Channels = new TeamChannelsCollectionPage
            {
                new Channel
                {
                    DisplayName = "WhatEver"
                }
            }
        };

        return await graphServiceClient.Teams.Request().AddAsync(team);
    }

还有其他人遇到这个问题吗?有 API 变化吗?团队后端是否已更改?有人有什么想法吗?

P.S.: 我正在使用最新的 Microsoft Graph NuGet-Package - 降级没有帮助。

更新(有一个不太令人满意的解决方法)

更新(详细错误信息)

System.AggregateException: 'One or more errors occurred. (Code: BadRequest Message: Failed to execute Templates backend request CreateTeamFromGroupWithTemplateRequest. Request Url: https://teams.microsoft.com/fabric/emea/templates/api/groups/theGroupId/team, Request Method: PUT, Response Status Code: BadRequest, ErrorMessage : {"errors":[{"message":"Team Visibility can not be specified as it is inherited from the group."}],"operationId":"639448e414ece64caee8f52839585bf7"} Inner error: AdditionalData: date: 2020-11-24T10:21:22 request-id: 37a28cac-3ac5-4bd2-a061-daf44c442fac client-request-id: 37a28cac-3ac5-4bd2-a061-daf44c442fac ClientRequestId: 37a28cac-3ac5-4bd2-a061-daf44c442fac )'

这是 Microsoft 的一个问题/错误,目前正在按照 here 所述进行修复。

今天早上刚刚测试过,我可以说,使用测试版 API 创建带有模板的团队的“旧方法”再次起作用。不知道还有多少其他方法可以完成这些事情,但这是我们当前的请求,现在(再次)有效。

POST https://graph.microsoft.com/beta/teams
{
    "displayName": "My Group Name",
    "description": "Some description",
    "template@odata.bind": "https://graph.microsoft.com/beta/teamsTemplates('educationClass')",
    "owners@odata.bind": [
        "https://graph.microsoft.com/beta/users('<someValidUserId>')"
    ]
}

我认为这只是一个中间状态,当错误修复后,他们将再次发布新版本,这种创建将再次失败,但如果在这种情况下,v1.0 记录的方法将起作用这不会是一个大问题。但是在开始推出之前得到通知会很棒。