[英]Powershell/office365 No more licenses available for AAD_basic
[英]Office365: Follow in inbox powershell
有没有办法将 PowerShell 命令写入一个组以“在收件箱中关注”?
或者 Microsoft Graph API?
我正在尝试通过代码来实现此功能,但看不到任何
文档。
在 Office 365 中,每个加入组的用户都可以使用下拉菜单选择在收件箱中关注或在收件箱中停止关注:
我不知道有可能通过 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”。
注意:这只对新会员有效,对现有会员无效!
谢谢你,汉尼斯
这是我写的 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
仅适用于组中的新成员
我正在搜索相反的命令,由于外部用户收到了不需要向外部发送的组的电子邮件,因此从 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>
我一直在为这个确切的主题编写一些示例命令: 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
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.