Forum Discussion

Lefty's avatar
Lefty
Copper Contributor
Feb 21, 2025

Where does Teams get its user list from? I can't make sense of which accounts I see vs which I can't

OK, so I have a currently rather unusual situation. I am looking at a 365 Tenant. A number of users have four accounts on the same tenant (let's not even get into why, cleaning things up is part of the reason I got called in).
When you start typing their name into teams it comes up with three of them as a suggestion (I only want one)

Account 1:
has just been used for ActiveDirectory for permissions to the company's Distributed File System (stored in on on premises servers in various locations). This account has to the best of my knowledge never had a license or mailbox associated with it, and so has never been on the global address list, it's also never had the teams app enabled for it. 
I don't want this one to show, but it does

Account 2:
A now defunct account which used to have a Business Standard license assigned to it, but has now had the licensed removed. Before the license was removed this account was hidden from the GAL and its teams app disabled.
I don't want this one to show, but it does

Account 3:
An now defunct account which still has a Business Standard license, but with Teams deselected in the Apps.
I don't want this one to show... and it doesn't

Account 4:
An account shared via a multi tenant organization (the users in question have been migrated to a new tenant). So these are members (not guests) but external ones.
I want this to show, and it does.

Now, accounts 2 and 3 will be deleted soon, whether we can get rid of account 1 depends on whether the necessary access to the DFS can be done using account 4 (which I need to look into next). However for the time being they are all there so I was trying to hide accounts I don't want users trying to message on teams from teams, and I cannot make any sense of which I see which I don't.

To sum up.
Account that has never been on the Global Address List and never been activated for Teams - Shows
Account that used to have a license and was on the GAL, and used in teams - Shows
Account that still has a license, but has been removed from GAL and had teams app disabled - Doesn't show
Account that has no license and is not on the GAL, but has teams on it's host tenant - Shows

After a previous inquiry I set "Scope directory search using an Exchange address book policy" in the teams setup, but I have not set up any specific address book policy as yet.

I have tried showing and hiding people from the global address list, and also the "ShowInAddressList" setting in Entra (which seems to only be available through graph?). 

Nothing seems to make a difference (it doesn't help that Teams takes forever to update its local cache for this stuff, so maybe a change DID make a difference at some point and I missed it).

I cannot find any logic as to which of these accounts is showing in the auto suggests and which not, most notably that account 1 shows but account 3 doesn't.

So, where is Teams getting its list of contacts from?

  • Take this:

     

    Sources of User Lists in Teams

    • Azure Active Directory (AAD): Teams pulls user information from AAD, which includes all user accounts in your Microsoft 365 tenant. This is why even accounts that have never been licensed or activated for Teams (like Account 1) can still appear.
    • Global Address List (GAL): Teams also references the GAL, which includes all mail-enabled objects in your organization. Accounts that were previously licensed and had mailboxes (like Account 2) can still show up if they were not properly removed from the GAL.
    • Teams Cache: Teams maintains a local cache of user information, which can sometimes cause delays in reflecting changes made to user accounts.

     

    Why Specific Accounts Show Up

    • Account 1: This account shows up because it exists in AAD, even though it has never been licensed or activated for Teams.
    • Account 2: This account shows up because it was previously licensed and mail-enabled, and it might still be present in the GAL.
    • Account 3: This account does not show up because it has been removed from the GAL and Teams app has been disabled.
    • Account 4: This account shows up because it is part of a multi-tenant organization and is recognized by Teams.

     

    Steps to Manage Visibility

    • Hide from GAL: Ensure that accounts you don't want to show are hidden from the GAL. This can be done using the Set-Mailbox cmdlet in PowerShell:
    Set-Mailbox -Identity "email address removed for privacy reasons" -HiddenFromAddressListsEnabled $true
    
    • Disable Teams for Specific Accounts: Use the Teams admin center or PowerShell to disable Teams for specific accounts.
    • Clear Teams Cache: To force Teams to update its local cache, you can clear the cache manually:
      • Close Teams.
      • Navigate to %appdata%\Microsoft\Teams.
      • Delete the contents of the Cache folder.
      • Restart Teams.
    • Lefty's avatar
      Lefty
      Copper Contributor

      So, regarding Account 2 (used to be active in teams, but no longer has a license), I tried an experiment.

      I reassigned the license, changed the job title (so I could see when Teams had refreshed its reference) and waited... and waited... and waited... and several hours later, saw teams had picked it up.

      As an aside, why does Teams take several hours to refresh this stuff? (It wasn't the local cache, I tried deleting it, no difference, this was in the server). "Efficiency" is no excuse, we're not talking about the contents of war and peace here, it's contact information! Half the world is on Discord and that will update practically instantaneously (hell even Outlook manages it in a semi-respectable timescale). And there seems to be no way to force a refresh of the server.

      Anyway, back to the process

      I then hid the account from the global address list and deselected "teams" from the apps, and waited... and waited...

      Finally it disappeared from Teams, when I typed in the name that account did not come up any more.

      Yay! Success!! Full of triumph I removed the license.

      Only to find ( a few hours later obviously ) that it had reappeared.

      So an account that doesn't appear on Teams when it has a license appears when you remove that license?

      That's just dumb!

    • Lefty's avatar
      Lefty
      Copper Contributor

      Thanks, for that info, I will give it a try.

      However -

      • Disable Teams for Specific Accounts: Use the Teams admin center or PowerShell to disable Teams for specific accounts.

      Where? How? I am probably going blind from searching high and low for solutions to this and other issues but I can't see this on the teams admin centre.
      As for powershell, is it in the teams powershell module? (should be obvious, but I've found it often isn't with 365)

Resources