Oct 10 2018
08:39 AM
- last edited on
Feb 01 2023
01:54 PM
by
TechCommunityAP
Oct 10 2018
08:39 AM
- last edited on
Feb 01 2023
01:54 PM
by
TechCommunityAP
I am trying to fetch unread emails from inbox of my office365 account using postman.
With the help of Microsoft Graph API reference i am able to generate access token as in below format:
POST https://login.microsoftonline.com/{{AAA_UID}}/oauth2/token { "token_type": "Bearer", "expires_in": "3600", "ext_expires_in": "0", "expires_on": "1539180610", "not_before": "1539176710", "resource": "https://graph.microsoft.com", "access_token": <ENCRYPTED_TOKEN> }
However my requirement is to fetch unread mails from Inbox.
Using the following link seems that can be possible, however while using in postman, getting "Invalid authentication, access token is empty" error.
https://graph.microsoft.com/v1.0/me/mailFolders('Inbox')/messages?$select=sender,subject
Can anyone please tell me how to append access token with the above code, if this is the right one.
Or if you know any simple and better procedure to fetch unread emails from office365 account, please advice.
Oct 10 2018 10:30 AM
You add the token to an auth header, something like this:
'Content-Type'='application\json' 'Authorization'="Bearer aaaaaaaaaaaaaaaaa"
Oct 10 2018 12:22 PM - edited Oct 10 2018 12:38 PM
While doing so with the below code:
GET /v1.0/me/messages HTTP/1.1
Host: graph.microsoft.com
Content-Type: application\json
Authorization: Bearer eyJ0eXAiOiJK..................
Getting below error. Have I missed anything?
{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"request-id": "bafebf1b-9c36-4571-81be-29d54468b172",
"date": "2018-10-10T19:36:40"
}
}
}
Oct 10 2018 11:19 PM
No idea, sorry. UnknownError doesn't give us much to work with :)