Monday, 4 June 2018

Hide Office 365 Groups from Outlook and OWA using Powershell

As you know Office 365 Group is the base service for other O365 services like Planner, Teams, Yammer, etc... So in some situations you may need to hide some groups from Exchange clients like Outlook and OWA. If you use Microsoft Teams, every team will use its own office 365 group as base service, as you know Teams is the best communication tool to have complete conversation within a team, so there is no need to use teams group in exchange client for conversation, in this case we can hide teams based office 365 groups in Exchange clients.

Hiding Office 365 groups from Exchange clients is easily achievable by using the Exchange Online Powershell cmdlet Set-UnifiedGroup with the parameter -HiddenFromExchangeClientsEnabled. Run the following command to hide a single office 365 group from OWA and Outlook client.
Set-UnifiedGroup "TeamsO365Group" -HiddenFromExchangeClientsEnabled:$true
You can disable the setting by just passing he value $false to the parameter HiddenFromExchangeClientsEnabled
Set-UnifiedGroup "TeamsO365Group" -HiddenFromExchangeClientsEnabled:$false

Lists Office 365 Groups Exchange Client Status :

You can easily check the exchange client status of all office 365 groups by running below command.
 Get-UnifiedGroup -ResultSize Unlimited | Select Name, HiddenFromExchangeClientsEnabled 
The below command lists only the groups that are hidden from exchange client.
 Get-UnifiedGroup -ResultSize Unlimited | Where-Object {$_.HiddenFromExchangeClientsEnabled -eq $true}

Export Office 365 Groups Exchange client status to CSV:

 Get-UnifiedGroup -ResultSize Unlimited | Select Name, HiddenFromExchangeClientsEnabled |
Export-CSV "C:\\O365-Groups-Exchange-Client-Status.csv" -NoTypeInformation -Encoding UTF8

Hide Bulk Office 365 Groups from Outlook and OWA :

We may required to hide multiple office 365 groups in single execution, in this case we can have group names in csv. We need to import csv file, and then pass every group to Set-UnifiedGroup cmdlet. Consider the csv file TeamGroups.csv that has unified groups with the column header GroupName.
Import-Csv 'C:\TeamGroups.csv' | ForEach-Object {
$o365group = $_."GroupName"
Set-UnifiedGroup $o365group -HiddenFromExchangeClientsEnabled:$true

Note: All O365 Groups in which HiddenFromExchangeClientsEnabled is set to True will not be visible on the left navigation menu in Outlook and OWA, but you can still access them on demand (ex: use Browse Groups in Outlook)


No comments:

Post a Comment