Which api should be used to check the mail.readwrite and user.read permissions are granted or not

Krishna 21 Reputation points
2022-09-09T04:56:38.987+00:00

If I call this method
var responseStatusString = await httpClient.GetStringAsync(https://graph.microsoft.com/v1.0/servicePrincipals?$filter=DisplayName eq 'Microsoft Graph')

Getting below error
Response status code does not indicate success: 403 (Forbidden).

httpclient:

239361-image.png

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

Accepted answer
  1. RajeshKumarMSFT 1,971 Reputation points Microsoft Vendor
    2022-09-09T14:19:20.453+00:00

    Hi @Krishna ,

    Hope you are doing well,

    I have tried to reproduce the the scenario to get assigned/granted permissions as per your requirement mentioned.
    Please use the below endpoint and grant the required permissions before running endpoint as per this reference link

    API :- https://graph.microsoft.com/v1.0/servicePrincipals/*******/oauth2PermissionGrants?$select=scope

    239532-image.png

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

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Krishna 21 Reputation points
    2022-09-12T06:46:18.177+00:00

    Added Application.Read.All permission , and things are working now,

    Thanks @RajeshKumarMSFT

    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.