cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jean-Christophe
Advocate II
Advocate II

User Presence in Teams, use it in PowerApp

Hello,

 

I would like to use the User Presence in a powerApp.

 

How can I get this status ( Available, Out of Office, Busy, Busy In a call ... ).

 

How can be notified of changes ?

 

Thanks.

14 REPLIES 14

Hi @Jean-Christophe,

 

I was working exacly on this kind of topic today, the only information I found was using MS Graph API however, here is the workaround to use PoweAutomate and get the status of the user:

 

You will need to use the operator called Send an HTTP request to Sharepoint:

RJ2K1_0-1642042719578.png

Once you select that, please enter the following information:

RJ2K1_2-1642045144432.png

 

Uri: /v1/users/{id}/presence | Please replace the "{id}" with the user id that you need to found.

For example: /v1/users/{id}/presence ---> /v1/users/dc74d9bb-6afe-433d-8eaa-e39d80d3a647/presence

 

If you run the flow you will get a JSON output with all the information of the presence of the user:

 

 

{
  "calendarData": {
    "isOutOfOffice": false
  },
  "forcedAvailability": {
    "expiry": "2022-01-20T02:34:00.0892683Z",
    "availability": "Available",
    "activity": "Available",
    "publishTime": "2022-01-13T02:34:00.0892683Z"
  },
  "capabilities": [
    "Audio",
    "Video"
  ],
  "availability": "Available",
  "activity": "Available",
  "lastActiveTime": "2022-01-13T02:14:38.545Z",
  "nextRefreshTime": "2022-01-13T02:49:38.545Z",
  "deviceType": "Desktop",
  "sequenceNumber": 64204440
}

 

If you want to use a condition let say "If the user is with the status Do not Disturb don't send the email"

In order to do that you need to Parse the JSON using the operation called "Parse JSON"

 

This operation will request you 2 things, the content and the Schema of the JSON

for the content use the output of the previous task and for the Schema you will need to copy the JSON output and paste it into the option called "Generate a Schema"

 

RJ2K1_3-1642045573815.png

 

Schema:

RJ2K1_4-1642045601488.png

The Schema will make the JSON content like a "usable variables"

 

Now you can use a Condition and comparate the availability of the user:

RJ2K1_5-1642045715697.png

Please keep in mind that the status shound be write like this:

  • Available
    Busy
    DoNotDisturb
    BeRightBack
    Away
    Offline

If you have any question just let me know!!

I hope this work for you 😀

jamilhaddadin12
Regular Visitor

They answer is yes, you can get notified on status change.
MS Teams presence supports "change notification" feature:

https://docs.microsoft.com/en-us/graph/webhooks

Hi @RJ2K1,

 

I am really thankful for your idea, i just have one problem, when i try to do the flow this appears, 

alejandraislas2_0-1642115672899.png

I don't know if I am missing something, 

Thanks in advance for your help! 🙂

 

You could work around that using expression :

string('https://presence.teams.microsoft.com')

this works for me:

martijnxd_0-1648649354762.png

 

craig_gregory
Frequent Visitor

I'm kicking the automate from my Power App and the automate is going to grab the requesters presence.  I have the presence in Graph API consented.  What I and running into is the Automate when tested will get back my presence with no issues, but once change it to requesters presence it errors in the Send an Http Request to SharePoint method Get with 404 Not found.

I have followed the following:

https://docs.microsoft.com/en-us/graph/api/presence-get?view=graph-rest-1.0&tabs=http#code-try-9
https://powerusers.microsoft.com/t5/Building-Power-Apps/User-Presence-in-Teams-use-it-in-PowerApp/td...

 

@mdevaney and @RJ2K1 what would you say I did incorrectly or am missing that is not stated in this post?
@Pstork1 including you too in case you might have insight also.  Appreciate each of you and your time.  Thank you.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (1,663)