Finding specific messages or threads using search tools within Microsoft Teams chat history
Hi Damian Lisak
Thank you for reaching out to Microsoft Q&A forum
From my research, the root cause of this behavior is that Teams Search relies on the Exchange Online Address Book index, and changing the Last Name in hybrid AD sometimes fails to trigger a re-index.
That said, you need to force it by following below approach:
On your On-Premises AD server:
# 1. Hide the user from the Address Book
Set-ADUser -Identity "username" -Replace @{msExchHideFromAddressLists=$true}
# 2. Sync to Azure AD
Start-ADSyncSyncCycle -PolicyType Delta
# 3. WAIT 1-2 HOURS for Exchange Online to fully process the removal
# 4. Unhide the user
Set-ADUser -Identity "username" -Replace @{msExchHideFromAddressLists=$false}
# 5. Sync again
Start-ADSyncSyncCycle -PolicyType Delta
Then have the users who are searching for this person clear their local Teams cache (Close Teams --> Win+R --> %localappdata%\packages\msteams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams --> delete contents --> reopen Teams).
Hope my answer will help you and kindly let me know if the problem still persists.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.