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

如何通过Graph API获取Azure Active Directory组的AllowToAddGuests设置值

解决方法:通过Graph API获取Azure AD组AllowToAddGuests设置值

你之前调用的allowExternalSenders字段用于控制Microsoft 365组是否接收外部邮箱发送的邮件,和允许添加访客的配置完全无关,因此无法满足需求。获取该配置的实际生效值需按以下流程操作:

1. 优先查询组级别的自定义配置

如果组单独配置了访客添加权限,该配置优先级高于租户默认设置,调用以下接口查询:
GET https://graph.microsoft.com/v1.0/groups/{替换为目标组ID}/settings

接口返回说明:

  • 若返回非空数组,找到displayName为Group.Unified.Guest的配置项,其中values数组内name = AllowToAddGuests对应的value值就是该组当前生效的访客权限配置
    示例返回值:
{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#settings",
  "value": [
    {
      "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "displayName": "Group.Unified.Guest",
      "templateId": "08d542b9-071f-4e16-94b0-71abb299f657",
      "values": [
        {
          "name": "AllowToAddGuests",
          "value": "false"
        }
      ]
    }
  ]
}
  • 若返回空数组,说明该组未做单独配置,使用租户全局默认值,执行下一步查询

2. 查询租户全局默认配置

调用以下接口获取租户级别的默认访客权限配置:
GET https://graph.microsoft.com/v1.0/settings

返回结果中找到displayName为Group.Unified的配置项,其中values数组内name = AllowToAddGuests对应的value值就是租户默认配置,即无组级自定义配置时的生效值。

所需接口权限

调用上述接口需要的权限如下,二选一即可:

  • 委托权限:Directory.Read.All、Group.Read.All
  • 应用权限:Directory.Read.All、Group.Read.All

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.13 19:57:01