Getting forbidden error while trying GetPresencesByUserId Graph API after following all the steps as required

Parth Baxi 20 Reputation points
2023-05-19T04:48:04.2566667+00:00

I tried all the steps to register the app, gave all the required permissions as per the document of GetPresenceByUserId, still getting the forbidden error.

On the other hand, when I tried other Graph APIs like to get User Information it is working fine.

Also searched for many community solutions but none of them worked.

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Accepted answer
  1. CarlZhao-MSFT 46,376 Reputation points
    2023-05-19T05:46:24.23+00:00

    Hi @Parth Baxi

    This endpoint does not support application permissions, so you must call the API in the context of delegation.

    User's image

    Try granting Presence.Read.All delegated permissions to your app, and then use the delegated authentication flow to get an access token, such as auth code flow or ROPC flow.

    Or use your user to log in to Graph Explorer and call the endpoint directly:

    2

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.


1 additional answer

Sort by: Most helpful
  1. AsithwMSFT 1,445 Reputation points Microsoft External Staff
    2023-12-25T00:01:19.78+00:00

    @Parth Baxi

    Get User Presence API with Application Permission now available in Graph v1.0. I verified it.

    See this comment too from December 21, 2023. The Graph API change log is not yet updated.

    therefore, following Api should work now with application permission.

    Copy

    https://graph.microsoft.com/v1.0/users/6e7b768e-07e2-4810-8459-485f84f8f204/presence
    
    https://graph.microsoft.com/v1.0/communications/presences/6e7b768e-07e2-4810-8459-485f84f8f204
    

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

    0 comments No comments

Your answer

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