【问题标题】:MS Graph: How To Distinguish Teams-Enabled M365 Groups Using GraphClient?MS Graph:如何使用 GraphClient 区分启用团队的 M365 组?
【发布时间】:2021-01-01 01:48:01
【问题描述】:

MS Graph REST API 显示 resourceProvisioningOptions 属性以指示 MS365 组是否也是团队(见下文)。但是,do not appear 中的这些值将在 GraphServiceClient 中可用。

我找到了 this post,并使用 sites endpoint 获取了 M365 组的关联 SharePoint URL。但一些 M365 组有 SharePoint 网站,而不是团队。

我发现的唯一其他选择是使用teams endpoint 并在未找到组 ID 的团队时捕获异常。但是我仍然需要执行其他站点端点查询来获取 SharePoint URL。

有谁知道在使用 GraphServiceClient 时区分团队/非团队 M365 组的另一种/更好的方法?

【问题讨论】:

    标签: c# microsoft-graph-api sharepoint-online microsoft-graph-sdks microsoft-graph-teams


    【解决方案1】:

    我想继续阅读 Baker_Kong 的有用帖子。

    此功能在 beta 和 v1.0 端点中都可用。 v1.0 元数据(我们用来生成模型)中没有描述它,这就是您在对象模型中看不到它的原因。在解决此问题之前,您可以使用 beta 客户端或:

    // Get only groups that have teams.
    var groupsThatHaveTeams = await client.Groups.Request().Filter("resourceProvisioningOptions/Any(x:x eq 'Team')").GetAsync()
    
    // When the metadata is fixed, each group will have a ResourceProvisioningOptions property that you can inspect for the 'Team' value.
    // Until then, you'd need to look at the Group.AdditionalData dictionary for the resourceProvisioningOptions key and check if it has the 'Team' value.
    var groupsThatMayHaveTeams = await client.Groups.Request().Select("id,resourceProvisioningOptions").GetAsync();
    

    https://github.com/microsoftgraph/msgraph-sdk-serviceissues/issues/44#issuecomment-752775347发帖

    【讨论】:

      【解决方案2】:

      @特蕾西,

      我在控制台应用程序中测试了 SDK,我相信此属性位于组实体下:

      或者您可以添加select 选项以省略返回的属性:

      graphClient.Groups.Request().Select("id,resourceProvisioningOptions").GetAsync().Result;
      

      BR

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多