【问题标题】:Office365: Follow in inbox powershellOffice365:在收件箱 powershell 中关注
【发布时间】:2021-05-21 07:34:03
【问题描述】:

有没有办法将 PowerShell 命令“关注收件箱”写入群组?
或者可能是 Microsoft Graph API?

我正在尝试通过代码来实现此功能,但看不到任何
文档。

在 office 365 中,每个加入群组的用户都可以使用下拉菜单选择在收件箱中关注或在收件箱中停止关注:

here an image example of follow in inbox

【问题讨论】:

  • 请详细描述您的问题。我不知道您所说的“关注收件箱”是什么意思。
  • 添加图片示例

标签: azure powershell office365


【解决方案1】:

我不知道通过 Powershell 可以做到这一点。您可以在Office365的AdminCenter gui的组设置中进行设置。

请看这里:https://docs.microsoft.com/en-us/office365/admin/create-groups/create-groups?view=o365-worldwide#how-following-group-email-works

更新:

看来你可以用 Graph API 做到这一点:https://docs.microsoft.com/en-us/graph/api/group-update?view=graph-rest-1.0

函数“UpdateGroup”和设置“autoSubscribeNewMembers”。

注意:这只会对新会员生效,对现有会员无效!

【讨论】:

    【解决方案2】:

    谢谢你,汉内斯
    这是我写的一个 PowerShell:

    $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
    

    仅适用于组中的新成员

    【讨论】:

      【解决方案3】:

      我正在搜索相反的命令,即由于外部用户收到了不需要向外部发送的组的电子邮件,因此从 powershell 手动取消订阅用户。

      这里是连接到 Exhange Online Powershell 版本 2 的 powershell 命令:

      查看订阅者:

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

      添加订阅者:

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

      删除订阅者:

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

      Documentation

      【讨论】:

        【解决方案4】:

        我一直在为这个确切的主题编写一些示例命令:Unsubscribe-FollowInInbox.ps1(获取代码示例的完整列表)

        一些示例:

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

        这是 PowerShell 让所有“成员”成为“订阅者”(又名“关注收件箱”)

        ##########################################
        #  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 = "test-team@example.com"
        
        #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
        }
        

        【讨论】:

          猜你喜欢
          • 2019-02-21
          • 1970-01-01
          • 2022-01-17
          • 1970-01-01
          • 1970-01-01
          • 2019-10-08
          • 2016-07-27
          • 2021-04-27
          • 2020-11-07
          相关资源
          最近更新 更多