无法在 Microsoft Teams 中将 Planner 创建为选项卡

Unable to create Planner as a Tab in Microsoft Teams

我有一组 Microsoft Teams,但我无法向其添加 Microsoft Planner 选项卡。当我尝试添加 Planner 时,我会看到对话框并输入 Planner 名称并单击“创建”,它会返回“创建计划失败”消息。没有返回其他信息。

并不是所有Microsoft Team都会出现这种情况,在teams app中正常创建的可以正常工作,但是我通过Microsoft Graph创建的有这个问题。这是我用来创建团队的代码。

public async Task<string> CreateTeam(string title, ClaimsPrincipal user)
{
    var userId = user.Claims.First(c => c.Type == "http://schemas.microsoft.com/identity/claims/objectidentifier").Value;
    var body = $"{{\"displayName\":\"{title}\",\"groupTypes\":[\"Unified\"],\"mailEnabled\":true,\"mailNickname\":\"{title.Replace(" ", "")}\", \"securityEnabled\":false, \"visibility\":\"Private\" }}";
    var res = await GraphClient.QueryGraphAsyncPost($"/groups", body, user);
    var result = await res.Content.ReadAsStringAsync();
    var group = JsonConvert.DeserializeObject<FieldInfoBucket>(result);
    var id = group.Id;

    res = await GraphClient.QueryGraphAsync($"/groups/{id}/owners", user);
    result = await res.Content.ReadAsStringAsync();

    body = $"{{\"@odata.id\": \"https://graph.microsoft.com/beta/users/{userId}\"}}";
    res = await GraphClient.QueryGraphAsyncPost($"/groups/{id}/owners/$ref", body, user);
    // ReSharper disable once RedundantAssignment
    result = await res.Content.ReadAsStringAsync();

    body =
        $"{{\"memberSettings\":{{\"allowCreateUpdateChannels\":true, \"allowDeleteChannels\":true, \"allowAddRemoveApps\":true, \"allowCreateUpdateRemoveTabs\":true, \"allowCreateUpdateRemoveConnectors\":true}}, \"guestSettings\":{{\"allowCreateUpdateChannels\":false, \"allowDeleteChannels\":false}}, \"messageSettings\":{{\"allowUserEditMessages\":true, \"allowUserDeleteMessages\":true, \"allowOwnerDeleteMessages\":true, \"allowTeamMentions\":true, \"allowChannelMentions\":true}},\"funSettings\":{{\"allowGiphy\":true, \"giphyContentRating\":\"strict\",\"allowStickersAndMemes\":true,\"allowCustomMemes\":true}} }}";
    res = await GraphClient.QueryGraphAsyncPut($"/groups/{id}/team", body, user);
    // ReSharper disable once RedundantAssignment
    result = await res.Content.ReadAsStringAsync();

    return id;
}

上面的 Graph 客户端只是针对 graph.microsoft.com/beta 端点发出 Get/Post/Put 命令并添加适当的 Bearer 令牌。

Planner 感到困惑的是,它是由非团队成员的用户询问的。如果我们使用 /AddMember api 显式添加当前登录的用户(所有者),那么它就可以正常工作。我们正在努力修复。