Skip to content

Instantly share code, notes, and snippets.

@tdalon
Created October 23, 2023 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdalon/9b3d6277707746756a153d8c6d49543e to your computer and use it in GitHub Desktop.
Save tdalon/9b3d6277707746756a153d8c6d49543e to your computer and use it in GitHub Desktop.
Teams New Switch Tenant
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
@tdalon
Copy link
Author

tdalon commented Oct 23, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment