Skip to main content
Version: 2.50.0

Allow To Add Guests

This article explains what the setting Allow guests in templates Microsoft 365 groups and Microsoft Teams does. In a new template the setting Allow guests is set to enabled by default. If an administrator decides to disable the setting, EasyLife will provision new Groups and Teams with the following group setting:

GET https://graph.microsoft.com/v1.0/groups/0aa429a9-c03e-4a8d-b68e-1deb88801b26/settings
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#groupSettings",
"value": [
{
"id": "e10883ef-19c7-4575-afc6-1e6256501a0c",
"displayName": "Group.Unified.Guest",
"templateId": "08d542b9-071f-4e16-94b0-74abb372e3d9",
"values": [
{
"name": "AllowToAddGuests",
"value": "false"
}
]
}
]
}

Change Allow To Add Guests For Existing Groups

The Microsoft Graph PowerShell SDK can be used to change enable or disable the setting for existing Groups or Teams. The following example disables the setting AllowToAddGuests for a group with the id 0aa429a9-c03e-4a8d-b68e-1deb88801b26. Note that after disabling the setting, guests can no longer be added to the group however, existing guests will not be removed:

Import-Module Microsoft.Graph.Groups
$groupId = '0aa429a9-c03e-4a8d-b68e-1deb88801b26'
# prepare body parameter hash table
$params = @{
TemplateId = "08d542b9-071f-4e16-94b0-74abb372e3d9"
Values = @(
@{
Name = "AllowToAddGuests"
Value = "false"
}
)
}
# add the setting Group.Unified.Guest and set AllowToAddGuests to false.
New-MgGroupSetting -GroupId $groupId -BodyParameter $params

The following example enables the setting AllowToAddGuests for a group with the id 0aa429a9-c03e-4a8d-b68e-1deb88801b26:

Import-Module Microsoft.Graph.Groups
$groupId = '0aa429a9-c03e-4a8d-b68e-1deb88801b26'
# get the id of the setting to be removed
$settingId = Get-MgGroupSetting -GroupId $groupId | Where-Object DisplayName -eq 'Group.Unified.Guest' | Select-Object -ExpandProperty Id
# remove the setting
Remove-MgGroupSetting -GroupId $groupId -GroupSettingId $settingId