SOLVED

Command Line args to goto channels directly?

Brass Contributor

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 `LOCALAPPDATA` + \Microsoft\Teams\current\Teams.exe works pretty reliable then just call this with `sip:name@company.com` and Voilà we chat!

 

Now I'd like users to be able to goto public channels with a click. I can get a link with Get link to channel. But running Teams.exe with this link does nothing! Just opens up the Teams main window with whatever was just open. No change.

 

I CAN just "run" this link with the webbrowser but then the user has to accept to always open the according links with MS Teams which is do-able but rather crude for some simpler users. And STILL one would have a useless web page open. Maybe the user doesn't even have a browser open... However it would be quite great to just go like:

 

Teams.exe %channel_link%

 

What command line switch do I need?

Is there a list of command line switches? like the sip: one?

I'd love to do sth like Teams.exe /? or -help ...

btw: Currently there is a big fat ERROR msg when you do Teams on the console window:

Error while parsing hooks JSON. Error: "ENOENT: no such file or directory, open 'C:\\Users\\techarteric\\AppData\\Roaming\\Microsoft\\Teams\\hooks.json'"
(node:17212) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

 

25 Replies
Could you please provide us with the commands that you are using and repro steps? So that it would be helpful for us to repro the issue.

@Meghana-MSFTI'm sorry I get the strong feeling that my post was not read :| ok... commands

 

main issue: Command Line args to goto channels directly?

The main "command" I'm using is Teams.exe the executable to run the Teams application on Windows.

So from another application I want to be able to run the Teams.exe with a command line switch to open a certain channel directly WITHOUT going over the browser.

Another "command" I'm using is the :link:Get link to channel option from a channel I want to link to.

 

Now just like one can do Teams.exe sip:username@company.com to chat directly with a given user

I'd like to be able to do something like Teams.exe channel:https://teams.microsoft.com/l/channel/19%3acb55... to open up Teams with the desired channel.

 

Of course this does not work. What "works" is opening the channel link with a browser. But ONLY if the user already enabled all the required checks to make the Browser entitled to do so. And then one still has a Browser open and a website which does not close on its own.

 

So I'm asking for a command line argument to make that happen!

OK. How can I search on my own: DuckDuckGo? Google? Bing? .. There seems to be nothing of value :\ sadly. Also the internal Help does not yield anything.

 

And finally like with any apps that do thing over the command line one can try "help" switches like:  /? -help -h --help -? ... however nothing seems to work. All just open up the Teams app.

 

And whenever you do that ... also without ANY arguments the app will also print this DeprecationWarning to the console. Repro:

  • Press Win key
  • type cmd
  • Press Enter key
  • type or copy/paste
    cd %LOCALAPPDATA%\Microsoft\Teams\current
  • type Teams.exe
  • Press Enter key

Result:

  • Teams app opens up
  • message in the cmd window:
    (node:9612) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

My version is 1.4.0.22976 at least that's the version detail on the executable.

best response confirmed by ericw190 (Brass Contributor)
Solution

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! :sign_of_the_horns:

 

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:

 

Another one. If you want to point to a message via command line and have it nicely highlighted this works very similarly:

 

msteams:l/message/19:{channel_id}@thread.tacv2/{message_id}?

 

So you can get rid of https://teams.microsoft.com/ in the front and all after ? in the end.

Turns out the ? at the end is important! Just like the / at the end of the channel template.

@ericw190 how do you retrieve the channel_id? 

@erik-on-windows 

ericw190_1-1635158068016.png

 

OK. Step by step:

ericw190_0-1635157784494.png

 

@ericw190 thanks for the step by step documentation. Seems so that on private channels "get link to channel" is not available. On a non-private channel it works like you described it. 

 

As well just with: 

C:\Windows\System32>start msteams:/l/channel/19:asdfasdfasdfasdfasdfdasf@thread.tacv2/

 

 

Ah nice! Good to know!

Yeah well, I didn't try this on private channels. The idea was to give all co-workers direct access to our channels from our custom tools ...

@ericw190 I'm looking for something a bit simpler.

 

All I want to do are basic command line switches like "start a chat with this person" or "call this person" from the Run prompt in Windows.

 

For Outlook, this is really simple. Here's an example for starting an email from the Run prompt: 

outlook.exe /c ipm.note

 

I would like to do the same for Teams, but there is no published documentation on actual command line switches.  Just the shortcuts that people can type manually in the search window of the actual application, like: /call

 

I want the ability to start a call with someone, or start a new message, without being in the Teams app at that particular time.

 

Can this be done?

https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/deep-links#generate...
this Doc will help

and one tricky for channel:
get "tab" link in your channel, it's a easy way to find key information
Then break the link(delete some letter in tab part), thanks to MS this will make you jump to channel-posts(main page).
or of couse, do that in the formal way through the Doc

@AnqB0VVRJMzsO6zV whoa, those "deep links" look really powerful. I've already tinkered with them, and have been able to use them to queue up messages to send to certain people, or even video call someone, directly from the Run menu.  Much obliged!!

@jholzbau "start a chat with this person" can still be done with the oldschool:

 

teams.exe sip:name@company.com

 

But the deeplinks doc looks really promising. Did you also use them on teams.exe directly or with start msteams: or other the web-link ?

@ericw190 here is what I ended up using:

 

To Chat with someone:  msteams:/l/chat/0/0?users=[username]@[company].com

To Video Call someone: msteams:/l/call/0/0?users=[username]@[company].com&withVideo=true

 

Very helpful.

@AnqB0VVRJMzsO6zV I have figured out how to jump directly to a channel from the Run menu -- thank you.

 

Here is where I'm struggling now, though. My weekly team meeting has a lively chat that continues in perpetuity. We chat during the meeting, and we keep chatting until the next meeting, and so on.  We don't actually choose the channel for discussion....we use the Chat for the actual recurring meeting, which presents to me as just another chat thread.

 

I'm able to jump to various chat threads with the deep links (e.g. msteams:/l/chat/0/0?users=[list of email addresses]&topicName=[chat thread name].  But I can't use that same method to jump to the "chat" of a recurring teams meeting. I assume because what I'm passing via deep link is the list of users and the name of the thread, but *not* the actual meeting ID.

 

Is there a way to pass the meeting ID into this, so that I can quickly jump to the "chat" for the meeting?  Something like this, perhaps?

msteams:/l/chat/0/0?users=[list of email addresses]&topicName=[chat thread name]&meetingID=[meeting ID]

 

maybe there is way...but sorry I don't know how to do it yet

if I understand your's right, you want a link to "open a chat history for a meeting directly"
from what I have now(maybe you can use it as web workaround?)

instead of chat has a thread, every meeting format in web is like
"https://teams.microsoft.com/_#/conversations/19:meeting_IDXXXX@thread.v2?ctx=chat"

hope you can find a way to make it jump from web to client
I tried and failed to use “l" or "_#" as the 1:1 chat change between web&client is "https://teams.microsoft.com/l/chat/0/0?users=A@A.COM,B@B.COM" to "https://teams.microsoft.com/_#/l/chat/0/0?users=A@A.COM,B@B.COM(&deeplinkid)"

of cousre we can change how system open URL start from "https://teams.microsoft.com"
but I don't think it's the right way for this

Yeah Nice! True these call work directly from Run dialog.
Another awesome benefit over the sip:-method is that we can simply add chat members like so:

msteams:/l/chat/0/0?users=name1@company.com,name2@company.com

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]) :thinking_face:
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)

@ericw190 

I use 

 subprocess.call("cmd /K start sip:" + email)

 The python script is called from a vbs-wrapper-script, which suppresses the DOS-box. 

@erik-on-windows 

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!

1 best response

Accepted Solutions
best response confirmed by ericw190 (Brass Contributor)
Solution

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! :sign_of_the_horns:

 

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:

 

View solution in original post