2

Is there a way to write PowerShell command to "Follow in inbox" to a group?
or maybe Microsoft Graph API?

I am trying through the code to implement this feature, but can't see any
documentation.

In office 365 every user that joins a group can use the dropdown to select Follow in inbox or Stop following in inbox:

here an image example of follow in inbox

2
  • Please describe your questions in more details. I dont know what you mean with "follow in inbox". Commented Dec 10, 2018 at 12:50
  • 1
    added image example Commented Dec 10, 2018 at 12:57

4 Answers 4

2

I dont know a possiblity to do that via Powershell. You can set it in the AdminCenter gui of Office365 in the group settings.

See here: https://learn.microsoft.com/en-us/office365/admin/create-groups/create-groups?view=o365-worldwide#how-following-group-email-works

Update:

It seems that you can do it with the Graph API: https://learn.microsoft.com/en-us/graph/api/group-update?view=graph-rest-1.0

Function "UpdateGroup" and the Setting "autoSubscribeNewMembers".

Note: This will only take effect for new members not for existing ones!

Sign up to request clarification or add additional context in comments.

Comments

2

Thank you, Hannes
This is a PowerShell I wrote:

$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 all Office 365 Groups that AutoSubscribeNewMembers disabled#>
$O365Groups = Get-UnifiedGroup | Where-Object{$_.AutoSubscribeNewMembers -eq $false}

<#Iterate through the Groups, enabling the AutoSubscribeNewMember#>
foreach ($group in $O365Groups)
{
Set-UnifiedGroup $group.Identity -AutoSubscribeNewMembers:$true
}

<#Close the Session#>
Remove-PSSession $Session

Works fine only for new member in the group

Comments

1

I was searching for the opposite command, to unsubscribe a user manually from powershell due to an external user receiving the emails for a group that were unnecessary to send externally.

Here are the powershell commands, connected to Exhange Online Powershell version 2:

View subscribers:

Get-UnifiedGroupLinks -Identity <email address> -LinkType Subscribers

Add subscribers:

Add-UnifiedGroupLinks -Identity <email address> -LinkType Subscribers -Links <comma separated list of email addresses>

Remove subscribers:

Remove-UnifiedGroupLinks -Identity <email address> -LinkType Subscribers -Links <comma separated list of email addresses>

Documentation

Comments

0

I have been working on some sample commands for this exact topic: Unsubscribe-FollowInInbox.ps1 (for full list of code samples)

Some samples:

#Check subscription status for ALL unified groups
Get-UnifiedGroup | Format-Table Name,*subscribe* -AutoSize

Here is PowerShell to make all "members" in to "subscribers" (aka Follow In Inbox)

##########################################
#  Loop 1 - SUBSCRIBE all group members  #
##########################################

#Store the team name in a variable. Change this to match your team. 
#To find this for your team, use (Get-UnifiedGroup *test-team*).PrimarySmtpAddress
$teamname = "[email protected]"

#Find all the members of the Unified Group "test-team" and store their UserMailbox objects in a variable called "members"
$members = Get-UnifiedGroup $teamname | Get-UnifiedGroupLinks -LinkType Member

#Create a variable to keep track of how many members we have subscribed or unsubscribed
$membercount = ($members.Count)

#Loop through the list of members and add a subscriber link for each one
foreach ($member in $members) 
{
    #Decrement the member count
    $membercount--
    
    #Write progress to the PowerShell window
    Write-Host "Adding subscriber link for user $($member.PrimarySmtpAddress), $membercount users remaining"
    
    #Add the UnifiedGroupLink to make each user a subscriber
    Add-UnifiedGroupLinks -Identity $teamname -Links $($member.PrimarySmtpAddress) -LinkType Subscriber -Confirm:$false
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.