A user can subscribe to a Microsoft 365 Group, or this can be done automatically by an administrator in a company. In that case, all group mails and group calendar events will be delivered to both the group mailbox AND the user mailbox.
Groups created through Microsoft Teams have this setting "off" by default, so new members don't get subscribed automatically. This works perfectly for groups with manually managed membership, but goes wrong when using dynamic group membership. For some reason, any new member in my dynamic groups will always be subscribed even with the auto-subscribe toggle turned off 🤯.
Until Microsoft fixes this (I will log a ticket!), I regularly run a PowerShell script for these groups with dynamic membership rules:
$Team = "MyTeam"
$Members = Get-UnifiedGroupLinks -LinkType Members -Identity $Team
Foreach ($Member in $Members) {
Remove-UnifiedGroupLinks -LinkType Subscribers -Links $Member.PrimarySmtpAddress -Identity $Team -Confirm:$false
}
You will need the Exchange Online Management PowerShell module installed, and then the script will do the following:
- Get all members from a specific Group/Team. Update the
$Team
variable with the mailNickname of the Group you want to adjust. - Loop over each member and remove that member as a subscriber
BOOM DONE! That simple 😃.