Application permission for Get Presence is still not working

lakshmi 491 Reputation points
2024-01-18T14:33:41.6066667+00:00

Hi, Previously, I submitted a request to check the feasibility of using Microsoft Graph API's Get Presence without requiring user sign-in. During that time, application permission support was not available for this functionality. I got the link below to get updates regarding the application permission implementation for Get Presence. Link: Microsoft Tech Community - Graph API Presence Application Permissions It appears that the feature has been implemented, although it hasn't been reflected in the documentation yet. Document Link: Microsoft Graph API - Presence - Permissions Today I have tried to get the presence using the application permission without signing. and i am getting status like 'Waiting for activation' User's image

Could you please help to get an update on this Thank you

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,989 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 35,016 Reputation points
    2024-01-19T08:34:17.56+00:00

    Hi @lakshmi

    The application permission for the "Get presence" API is currently available and it works fine for me.

    User's image

    var scopes = new[] { "https://graph.microsoft.com/.default" };
    
    var tenantId = "{tenant id}";
    
    // Values from app registration
    var clientId = "{client id}";
    var clientSecret = "{client secret}";
    
    // using Azure.Identity; 
    var options = new TokenCredentialOptions
    {
        AuthorityHost = AzureAuthorityHosts.AzurePublicCloud
    };
    
    // https://learn.microsoft.com/dotnet/api/azure.identity.clientsecretcredential
    var clientSecretCredential = new ClientSecretCredential(
        tenantId, clientId, clientSecret, options);
    
    var graphClient = new GraphServiceClient(clientSecretCredential, scopes);
    
    var result = await graphClient.Users["{user id}"].Presence.GetAsync();
    

    Please try upgrading your graph SDK to above 5.0 and remove the Request() method.

    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.