You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

调用Microsoft Graph的Groups[groupId].Members仅返回成员ID,无法获取完整属性

调用Microsoft Graph API获取组成员仅返回ID,无法获取用户详情

按照Microsoft Graph官方文档中group-list-members接口的说明,调用Groups[groupId].Members接口时,返回的成员数量正确(比如组有2个成员就返回2个对象),但仅能获取到成员ID,displayName、givenName等其他用户详情属性均无法返回。

重现步骤(已完成应用注册及权限配置)

  • 创建团队并添加成员
  • 调用Groups[groupId].Members.GetAsync方法尝试获取成员完整详情

原始代码片段

_clientSecretCredential = new ClientSecretCredential(tenantId, Helper.Tenant.Get(tenantId).ClientID, Helper.Tenant.Get(tenantId).ClientSecret);

_appClient = new GraphServiceClient(_clientSecretCredential,
        // 使用默认范围,会请求应用注册中配置的权限范围
        new[] { "https://graph.microsoft.com/.default" });

return await _appClient.Groups[groupId].Members.GetAsync();

输出情况

返回的成员对象仅包含id字段,其余用户属性均未返回。

已尝试的解决方法

显式指定需要返回的属性,但问题依然存在:

return await _appClient.Groups[groupId].Members.GetAsync((requestConfiguration) =>
{
    requestConfiguration.QueryParameters.Select = new string[] { "id","displayName" };
});

已验证的内容

  • 在Graph Explorer中可以正常查看成员的所有属性
  • 已确认应用注册的权限配置正确,已添加所需的组权限

内容的提问来源于stack exchange,提问作者TechTurtle

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 07:35:24