Forum Discussion
Hide Users from Teams Directory
This the Microsoft documentation on 'Limit who users can see when searching the directory in Teams'
https://learn.microsoft.com/en-us/microsoftteams/teams-scoped-directory-search
To achieve the objective of hiding users (guests or unlicensed users of MS Office 365), two steps need to be performed
1. Set "ShowInAddressList" property of user in Azure Entra/AAD. Unfortunately, I do not see option to perform this in Entra Portal. Only PowerShell scripts is possible, as follows.
Set-AzureADUser -ObjectId "email address removed for privacy reasons" -ShowInAddressList $false
2. Change MS Teams setting by following the link below.
https://learn.microsoft.com/en-us/microsoftteams/teams-scoped-directory-search
To turn on search by name, on MS Teams
In the Microsoft Teams admin center, select Teams > Teams settings. Note: In case Teams Admin Centre page not loading, open in Incognito mode
Under Search by name, next to Scope directory search using an Exchange address book policy, turn the toggle On.
When Scope directory search using an Exchange address book policy is turned on, all accounts that are marked as hidden in Exchange won't show up in Teams searches.
Note (as per above MS Teams documentation):
It may take a few hours for this change to take effect.
Turning on search by name hides the Search teams box and public teams listing in Join or create a team in Teams. It will also disable joining a team by typing /join in the command box at the top of Teams.
- jongrahamJun 05, 2024Copper ContributorWe have a mailbox for users to email our help desk, but we don't use it in Teams. I need to keep it visible in Exchange/Outlook/GAL for email, but hide it from Teams. The procedure above doesn't seem to allow this, or am I not understanding correctly?
- peter-supplyJun 06, 2024Brass ContributorWe sync users from local AD. We have the msExchHideFromAddressLists set to "TRUE." We have the "Scope directory search using an Exchange Address book policy" toggled to "on." But the user accounts with no license and "hidden" from the GAL still show in Teams. Thoughts?
- dmwadminMay 17, 2024Copper ContributorYes. We found that we have to hide the mail-enabled "admin accounts" from both exchange address list in order for them to be hidden Teams too.
The problem is that we also have non-mail-enabled "admin accounts". We end up having to set the msExchHideFromAddressLists to $true on the AD account that is synchronized to Azure/Entra in order for it to be hidden from Teams too.
It would be nice to exclude non-mail-enabled accounts from Teams by default.