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

2024-06-18

我有一组 Microsoft Teams,无法向其中添加 Microsoft Planner 选项卡。当我尝试添加规划器时,我会出现一个对话框,输入规划器名称,然后单击“创建”,它会返回“创建计划失败”消息。不返回其他信息。

这种情况并非在所有 Microsoft 团队中都会发生,在团队应用程序中正常创建的团队工作正常,但我通过 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 感到困惑的是,它是由非团队成员的用户提出的。如果我们显式添加当前登录的用户(所有者)/添加成员 API https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/group_post_members然后就可以正常工作了。我们正在努力修复。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法在 Microsoft Teams 中将 Planner 创建为选项卡 的相关文章

随机推荐