user3181435
user3181435

Reputation: 21

ResourceNotFound Microsoft Graph Api with correct token

I want to use microsoft graph API in my application without user. For I got access token by tenant id (a8ef7dd1-217d-430f-9ba0-4dd465b9098d) using this url

https://login.microsoftonline.com/a8ef7dd1-217d-430f-9ba0-4dd465b9098d/oauth2/v2.0/token

I see correct result after this request. Afte that I try to get user using this url https://graph.microsoft.com/v1.0/users

It also works fine for me. Example response: {"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#users","value":[{"businessPhones":[],"displayName":"IOTA CLM","givenName":"IOTA","jobTitle":null,"mail":null,"mobilePhone":null,"officeLocation":null,"preferredLanguage":null,"surname":"CLM","userPrincipalName":"clm-iota_outlook.com#EXT#@clmiotaoutlook.onmicrosoft.com","id":"50ecbaed-9cee-411f-abb6-5e53e2a1051a"}]}

But if I try to get mailFolders using next get request

https://graph.microsoft.com/v1.0/users/50ecbaed-9cee-411f-abb6-5e53e2a1051a/mailFolders

I see 404 error :

"code": "ResourceNotFound", "message": "Resource could not be discovered."

What I missed?

Upvotes: 1

Views: 4328

Answers (2)

seung7642
seung7642

Reputation: 91

I've had the same error.

You probably didn't assign a license while adding users at https://admin.microsoft.com

If you go to the Microsoft site, you will find that you need to license Exchange Online to use the Exchange Online feature.

  • https://learn.microsoft.com/en-us/exchange/exchange-online

Check it out!

Upvotes: 0

Jeremy Thake MSFT
Jeremy Thake MSFT

Reputation: 2138

Are you sure that that user has a mailbox?

Make sure you have the correct permissions? To access mail, you require Mail.Read application permissions that have been admin consented. https://learn.microsoft.com/en-us/graph/api/user-list-messages?view=graph-rest-1.0

You can admin consent where you've registered the application in the portal in the "Permissions" tab of the application. https://aad.portal.azure.com

Upvotes: 0

Related Questions