Introduction
Use the "sw" keyword followed by the Tenant name (partial match, starting letters), match is case insensitive.
Request
On Twitter by Dennis Doomen: https://x.com/ddoomen/status/1703744220438069470?t=_5UN81GFIODvRc1MzdkDjA&s=09
Solution Idea
Click on the Avatar: AutomationId: idna-me-control-avatar-trigger
Click on the Menu on the bottom to Switch - Find by Name/Type
AutoHotkey Code
Code is available in the Teams Library Lib/Teams.ahk -> Teams_SwitchTenant function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Teams_SwitchTenant(sTenant) { | |
WinId := Teams_GetMainWindow() | |
If !WinId ; empty | |
return | |
UIA := UIA_Interface() | |
TeamsEl := UIA.ElementFromHandle(WinId) | |
If !TeamsEl.FindFirstBy("AutomationId=idna-me-control-set-status-message-trigger") { ; menu not opened | |
; Click on avatar | |
MeCtrl := TeamsEl.FindFirstBy("AutomationId=idna-me-control-avatar-trigger") | |
MeCtrl.Click() | |
El:= TeamsEl.WaitElementExistByNameAndType("Switch to " . sTenant,"MenuItem",,1,False,1000) | |
} Else { ; menu already opened | |
El:= TeamsEl.FindFirstByNameAndType("Switch to " . sTenant,"MenuItem",,1,False) | |
} | |
If (El="") { | |
TrayTipAutoHide("Switch Tenant","Tenant name starting with '" . sTenant . "' not found!") | |
} Else | |
El.Click() | |
} ; eofun |
Teamsy usage
Use the "sw" keyword followed by the Tenant name (partial match, starting letters), match is case insensitive.
Pretty easy.