How can I read local MS Teams status

I am trying to implement a hardware busy light to show my Microsoft Teams presence so that my family to not enter the room I have the office while I am in a meeting. I am looking to implement something similar to:

The only problem I have with this setup is that I cannot get the MS Teams status.

The best way to go is by using MS Graph Presence API but my problem is that this is a company account and I don’t have (and there is no way I could have) and app in the main subscription granted with the required scope: Presence.Read.

So I tried different ideas but none worked in the end:

  • check local running processes
  • check if MS Teams exposes any local API
  • check if there is a CLI available

This seems a simple idea, I mean, I see the status right there now while I am typing this message, I could as well do an app that gets a screenshot of the taskbar and extract the status from the icon, but is that really the only option I have?

Answer

I think I found something interesting for you.

Go to

C:UsersuserAppDataRoamingMicrosoftTeams 

you’ll find a file called logs.txt

In this file you see if your current state changed

(current state: Available -> DoNotDisturb)

I would write a script with php or VB (depends on your skills) that read that logs.txt file like every minute and check for the last “current state” line.