Ebrahim Moshaya
Ebrahim Moshaya

Reputation: 817

Office365 Groups PowerShell to Subscribe Members

I created a new office365 group using the below powershell

New-UnifiedGroup -DisplayName "Office 365 Group" -AccessType "Private" -PrimarySmtpAddress "[email protected]" -Owner "e.moshaya" -Members "e.moshaya" -Alias "new-group" -Notes "Office 365 Group" -SubscriptionEnabled -RequireSenderAuthenticationEnabled $false -AlwaysSubscribeMembersToCalendarEvents

However, it's not enabling the subscribe members toggle as you see in the screenshots below. I'm trying to enable the "Subscribe Members" toggle, which would allow "Send copies of group conversations and events to group members’ inboxes."

I checked https://learn.microsoft.com/en-us/powershell/module/exchange/users-and-groups/new-unifiedgroup?view=exchange-ps and there's no option to enable this toggle.

enter image description here

enter image description here

Upvotes: 0

Views: 10689

Answers (2)

KuN
KuN

Reputation: 1211

This is the script I built a few years ago which will scan all available groups and subscribe any users that are not subscribing to their group(s).

# ref: https://answers.microsoft.com/en-us/msoffice/forum/msoffice_outlook-mso_win10-mso_o365b/how-to-subscribe-all-members-to-office-365-group/e998a92e-04a0-4d56-8b99-67099d1babb3
# when you create group without changing subscriber setting, all group member added during the creation will not subscribe to group msg. Even worse, when you create a group by creating a new team, this option won't even show up (in older versions).
# this script will list and re-configure so all group members will subscribe to all of their groups

#Set-ExecutionPolicy RemoteSigned
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session

# get array of the user emails whose user is not subscribing to current group
function Get-NaughtyUserList {
  Param($GroupName)
  $MemberList = Get-UnifiedGroupLinks -Identity $($GroupName) -LinkType Members | ForEach-Object{$_.PrimarySmtpAddress}
  $SubscriberList = Get-UnifiedGroupLinks -Identity $($GroupName) -LinkType Subscribers| ForEach-Object{$_.PrimarySmtpAddress}

  $NaughtyUser = $MemberList |Where-Object {$SubscriberList -notcontains $_}
  If($NaughtyUser) {
    Write-Host $NaughtyUser
    Return $NaughtyUser
  } Else {
    Write-Host All Clean!
  }
}

Get-UnifiedGroup | ForEach-Object {
  Write-Host $_.Name
  $List = Get-NaughtyUserList -GroupName $_.Name
  If($List) {
    Add-UnifiedGroupLinks -Identity $_.Name -LinkType Subscribers -Links $List.Split(',')
    Get-NaughtyUserList -GroupName $_.Name
  }
}



Remove-PSSession $Session

Upvotes: 1

KrishnaG
KrishnaG

Reputation: 3484

AFAIK you may use Set-UnifiedGroup cmdlet with AutoSubscribeNewMembers parameter to accomplish your requirement.

Note: The AutoSubscribeNewMembers switch specifies whether to automatically subscribe new members that are added to the Office 365 Group to conversations and calendar events. Only users that are added to the group after you enable this setting are automatically subscribed to the group. So you may use Set-UnifiedGroup cmdlet with AutoSubscribeNewMembers parameter to true as soon as you create your group and before adding members to the group.

Hope this helps!! Cheers!!

Upvotes: 1

Related Questions