Forum Discussion
ericw190
Sep 21, 2021Copper Contributor
Command Line args to goto channels directly?
Hello! So in our custom tools we try to give quick access to the responsible people. Its already possible to chat with co-workers in Teams with a click. In the background: getting the executable from...
- Sep 28, 2021
Alright I got it! the command line switch to do this is msteams:
I just took such a channel link, quit Teams from the sys tray, The browser opens it with the command I'm looking for and then it will still be on the command line args of the running Teams.exe! 🤘
What I noticed is that the link is UBER long! In my case 345 characters.
The app actually complains about a LOT of stuff in there:
'tenantId' is not recognized as an internal or external command, operable program or batch file. 'deeplinkId' is not recognized as an internal or external command, operable program or batch file. 'launchAgent' is not recognized as an internal or external command, operable program or batch file. The system cannot find the file specified. 'directDl' is not recognized as an internal or external command, operable program or batch file. 'msLaunch' is not recognized as an internal or external command, operable program or batch file. 'enableMobilePage' is not recognized as an internal or external command, operable program or batch file. 'fqdn' is not recognized as an internal or external command, operable program or batch file.
So these can ALL be stripped off the link already and even groupId and type aren't needed!
One can even shorten off the name up to the slash like:
msteams:/l/channel/19:vv8s7adsd9sdf7vs9fvd9f7v9d7s@thread.tacv2/
and that's all you need: convert %3a to : and %40 to @ , cut off after tacv2/ voilà!
If you'd like to store different channels: just take the ID between : and @ and use a template like
msteams:/l/channel/19:{channel_id}@thread.tacv2/
🙇:female_sign:
ericw190
Apr 27, 2022Copper Contributor
Since I call from Python eventually I was unable to use these calls without a path of teams.exe. (which is a solved problem ...) But I thought there was something to put on the Python subprocess.call() to make this work?
Was it .call(['start', cmd]) 🤔
Just prepending start works in a command line window no problem but not from subprocess.call().
What works there is getting os.getenv('COMSPEC') and calling it all together like:
subprocess.call([os.getenv('COMSPEC'), '/c', 'start', cmd])
But it pops a command line window for a splitsecond and seems a bit weird that it doesn't work simpler? Any Ideas?
(I know how to solve the command line window popping but that makes it even longer)
- erik-on-windowsApr 27, 2022Copper Contributor
I use
subprocess.call("cmd /K start sip:" + email)
The python script is called from a vbs-wrapper-script, which suppresses the DOS-box.
- ericw190May 02, 2022Copper Contributor
Oooh really?! pcheew. Well, If you want to know: there is also a python only way to do this. It's just 3 more lines:
startup_info = subprocess.STARTUPINFO() startup_info.wShowWindow = subprocess.SW_HIDE startup_info.dwFlags |= subprocess.STARTF_USESHOWWINDOW subprocess.call([com, '/k', 'start', cmd], startupinfo=startup_info)
where com is like com = os.getenv('COMSPEC') and cmd your msteams-call.
Oh! you put the /k there! Hmm. Also good. As the command is moving things into a thread and then returns it probably doesn't matter. But yea: it's probably better in case it does not return!
- erik-on-windowsMay 03, 2022Copper Contributorericw190 good to know 🙂 It fit' not to my usecase. I call the script from a command launcher (https://launchy.net/). With your describe solution it still pops-up a dos-box, which I want to avoid.
With the vbs-wrapper script it works fine for me.