LINKeRxUA
LINKeRxUA

Reputation: 559

Outlook api. How to search emails with oauth token?

Is there any working and complete code samples that demonstrate how to work with hotmail api?

For example I've already made for gmail api with web application:

Now I need to integrate hotmail.
done only:

That code samples that I found in official documentation doesn't shows how to pass oauth token - thats why have a lot of questions

Share some links that will help me, please!

Upvotes: 0

Views: 1296

Answers (1)

David
David

Reputation: 2447

I recommend you use the Microsoft Graph to read and search emails. It works for work, school and personal Microsoft accounts (hotmail, live, outlook.com, etc).

Since you already have an access token, just pass it through with an Authorization header. More information about using access tokens with the Microsoft Graph can be found in their documentation.

Authorization: Bearer [Access Token]

For searching email, try the following query: GET https://graph.microsoft.com/v1.0/me/messages?$search="hello world". If you're trying to search for emails in a different user's mail, try:

GET https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}/messages?$search=foobar

I also recommend trying the Microsoft Graph Explorer since it has sample queries for Outlook Mail. To show the Outlook samples, click the show more samples link. Also, clicking the icon to the right of each query will bring you to the documentation page for that sample.

enter image description here

Upvotes: 2

Related Questions