Error access denied in microsoft graph api to read user messages - ms-office

When I call https://graph.microsoft.com/v1.0/me/messages in Postman, it returns this error:
{
"error": {
"code": "ErrorAccessDenied",
"message": "Access is denied. Check credentials and try again.",
"innerError": {
"request-id": "ea5ef6c7-5c89-4ad6-975f-aec77e6f5064",
"date": "2019-02-25T12:00:07"
}
}
}
Provide all permission that the app needs. Except this "Use Exchange Web Services with full access to all mailboxes" in office 365 Exchange online and also give grant permission but still can't access.

I recommend you set the permissions for your app in the Azure Portal here:

Related

Access denied issue for Microsoft graph api

When I share excel url with personal one drive account and doing get request of URL details with office account token I have an issue when using shared url from personal drive which has the format
https://1drv.ms/x/s!{token}
or
https://onedrive.live.com/view.aspx?resid=B4FDB33875A82&ithint=file%2cxlsx&authkey=!EKQJrE3T5A
Permissions Scopes I have given as per documentation
Request :
GET https://graph.microsoft.com/v1.0/shares/{shareIdOrEncodedSharingUrl}/driveItem
Response :
{
"error": {
"code": "accessDenied",
"message": "The sharing link no longer exists, or you do not have permission to access it.",
"innerError": {
"date": "2022-06-29T12:49:15",
"request-id": "e1e9f673-1b66-49f3-8abd-70a1240f5442",
"client-request-id": "e1e9f673-1b66-49f3-8abd-70a1240f5442"
}
}
}

Outlook Open Another Mailbox Access Denied

I am trying to open another mailbox from Outlook/Access a different email account using the Graph API. Within the exchange admin centre, I have enabled Full Access to the mailbox I am trying to access. However when I try open the account the account from Outlook using 'Open Another mailbox' I get this error:
UTC Date: 2022-01-20T04:32:42.882Z
BootResult: accessDenied
Client Version: 20220110007.08
err: Microsoft.Exchange.Data.StoreObjects.AccessDeniedException
esrc: StartupData
et: ServerError
estack: Microsoft.Mapi.MapiExceptionNoAccess
st: 500
ehk: X-OWA-Error
efe: SY6PR01CA0002
ebe: SY4PR01MB6948
ewsver: 15.20.4909.8
emsg: ErrorPermissionDenied
I've also tried doing this through the Graph Explorer using the endpoint (https://graph.microsoft.com/v1.0/users/userId/messages)But I get an error saying the folder is unavailable.
{
"error": {
"code": "ErrorFolderNotFound",
"message": "The specified folder could not be found in the store.",
"innerError": {
"date": "2022-01-20T04:41:59",
"request-id": "4f835246-029b-47af-86d5-15f5dbb52bde",
"client-request-id": "20ae4819-d85e-dd92-fe6b-14fda438e947"
}
}
}
Am I missing some permission set or something? The user I am using I believe is an admin.

Getting error while creating online meeting using graph api

Here i am using Microsoft graph api for creating online meeting events but after generating toke when i am requesting to create an online meeting i am getting this error
{
"error": {
"code": "ResourceNotFound",
"message": "User not found",
"innerError": {
"date": "2021-09-01T17:54:57",
"request-id": "fa773652-e824-4c9e-af05-085e249fb489",
"client-request-id": "fa773652-e824-4c9e-af05-085e249fb489"
}
}
}
enter image description here
Based on the So thread reference,
Use Delegated permissions to create an onlineMeeting
You must log in as a user, and you cannot use the client credential flow. You need to use the auth code flow to obtain the token.
Ref link - Delegated Permission: https://learn.microsoft.com/en-us/graph/api/application-post-onlinemeetings?view=graph-rest-1.0&tabs=csharp
SO Reference: 404 error while creating Online Meeting using microsoft graph api c# without login into AzureActiveDirectory

"Update User" operation giving "Insufficient privileges to complete the operation.' error in Microsoft Graph API

I am trying to create a Reset password page, that will take the new password of the logged in user to reset the password of the user in Azure AD. I have read the information given in the following page, for User Update API.
https://learn.microsoft.com/en-us/graph/api/user-update?view=graph-rest-1.0&tabs=cs
I have
Directory.ReadWrite.All User.ReadWrite.All (delegated) and
User.ReadWrite.All (Application) permissions in Azure AD configuration page. I had asked another query in SO for creating users through MS Graph API, in which I learned how to create an Access token. I am following the same procedure to get access token for calling "User Update API". In Postman I am passing the below value.
PATCH https://graph.microsoft.com/v1.0/users/principalname#blah.in
Content-type: application/json
Authorization: bearer TOKEN
{
"passwordProfile":
{
"forceChangePasswordNextSignIn":false,
"password": "XXXXXXXXX"
}
}
When I execute this I get the following error
{
"error": {
"code": "Authorization_RequestDenied",
"message": "Insufficient privileges to complete the operation.",
"innerError": {
"request-id": "1ab4e11b-57e7-481f-9d93-296a3dece72c",
"date": "2019-05-10T05:13:19"
}
} }
I am unable to understand why I am getting this error because all permissions are given for the user.
I have gone through all the questions related to "Insufficient privileges to complete the operation" in SO before posting this question.
Because when updating the passwordProfile property, youn need the Directory.AccessAsUser.All permission.
See: https://learn.microsoft.com/en-us/graph/api/user-update?view=graph-rest-1.0&tabs=cs

Graph API encounter 400 failed to get drive in china

Before a day, the operation works fine.
https://microsoftgraph.chinacloudapi.cn/v1.0/users/{user_id}/drives
Suddenly, it keeps encounter this error:
{
"error": {
"code": "BadRequest",
"message": "Unable to retrieve user's mysite URL.",
"innerError": {
"request-id": "d50647af-33c2-4503-a6c1-eb046173108c",
"date": "2018-04-03T08:33:58"
}
}
}
I have checked the subscription and APP permission in graph API, all permission is enabled
And I have tested another APP using the same graph API permission which works fine.
Do not know what going wrong here
Thanks you.

Resources