Presence status of user is not setting using Graph API

Prajakta Kenjale 41 Reputation points
2022-06-03T08:31:21.287+00:00

We are using presence/setPresence API as given in https://learn.microsoft.com/en-us/graph/api/presence-setpresence?view=graph-rest-1.0&tabs=http through Postman.

It is giving 200 Ok. However, it is not showing any change on MS Teams Client.

When I Change presence status from Teams, I am able to get the updated presence in Postman using https://learn.microsoft.com/en-us/graph/api/presence-get?view=graph-rest-1.0&tabs=http

I am using MS Teams only on my laptop and trying to update presence using postman using Graph API. I am not using MS Teams on multiple devices.

Please help me to understand why it is not updating using setPresence Graph API.

  1. Is there any precedence related issue
  2. Is the issue due to beta version for setPresence https://graph.microsoft.com/beta/users/<userId>/presence/setPresence and we are using V1 version to get presence https://graph.microsoft.com/v1.0/<userId>/presence
Microsoft Teams | Development
Microsoft Teams | Development
Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs
Microsoft Security | Microsoft Graph
Microsoft Teams | Microsoft Teams for business | Other
{count} votes

6 answers

Sort by: Most helpful
  1. Schiffer Dustin 10 Reputation points
    2023-02-06T15:23:58.4466667+00:00

    Hi!

    I am observing similar behaviour!

    When using:

    https://graph.microsoft.com/v1.0/users/[USERID]/presence/setPresence

    The result is 200OK but it wont change the presence

    However, when using

    https://graph.microsoft.com/beta/users/[USERID]/presence/setUserPreferredPresence

    This is also responding with 200OK, but this one is working as expected.

    But, when i try to change the presence to busy/inacall, this is not working (Bad Request - 400) via setUserPreferredPresence, but with setPresence (200 OK - Although it wont change the presence in the client)

    /br

    Dustin

    2 people found this answer helpful.

  2. Prasad-MSFT 10,191 Reputation points Microsoft External Staff Moderator
    2022-06-03T10:40:27.667+00:00

    We tried to repro the issue at our end by running the Graph query in Postman and it works fine for us.
    Initially Teams status was 'Available' as below
    208212-image.png

    Then we fired below query to change the status to 'Busy'

    POST https://graph.microsoft.com/v1.0/users/xxxxx4d0-291b-xxxx-a85f-axxxx77aefxx/presence/setPresence  
    

    208168-image.png
    and the status got changed accordingly.
    208231-image.png

    Please follow below doc to check precedence order:
    https://learn.microsoft.com/en-us/graph/api/presence-setpresence?view=graph-rest-1.0&tabs=http#presence-sessions

    Thanks,

    Prasad Das


    If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.

    0 comments No comments

  3. Prajakta Kenjale 41 Reputation points
    2022-06-03T14:19:42.233+00:00

    Application Id is passed as sessionId?


  4. Prajakta Kenjale 41 Reputation points
    2022-06-06T08:12:16.937+00:00

    Ok.

    I tested it again.
    It worked 2 out of 4 times. One thing I observed that the change is reflected after couple of minutes and I was expecting immediately.

    Sometimes it gives error as 'The provided availability/activity is invalid' even if the values are correct as per values mentioned in properties table on https://learn.microsoft.com/en-us/graph/api/resources/presence?view=graph-rest-1.0 page

    eg. it gives above error for following.
    availability = 'BeRightBack';
    activity = 'BeRightBack';

    Can you point out what is the mistake?


  5. Prajakta Kenjale 41 Reputation points
    2022-06-06T11:18:16.127+00:00

    Thanks this helps


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.