Microsoft Outlook 365 Integration with Salesforce Using REST API with Example

Microsoft Outlook 365 Integration with Salesforce Using REST API with Demo

Outlook and Salesforce Integration

Here is the demo of the same built on Salesforce using Salesforce Sites. (

In this post, we will learn how to connect Salesforce with Outlook 365 using REST API.

For this, the first step is to create an Application in the “Microsoft App Registration Portal” ( Log in using your office 365 account credentials.

Click on Add an App button to start creating the application. Enter the Application Name and click create.  Now do as mentioned in the snapshot below:

Save the changes.

Once done create a URL in the format below:

Replace below values:
client_id value with your application Client ID.
redirect_uri with the page where you would like the user to redirect after authorization.
nonce should be same as your client id.

once the user authenticates on the above link he will be redirected to the URL you have configured in the app along with the #access_token 

This access token now can be used to send REST call to Microsoft to fetch details. 
Microsoft graph API's details and examples can be explorer using Graph Explorer. (

Sample code for fetching latest emails
HttpRequest request = new HttpRequest();
        AuthoriztionValue= 'bearer ' + Access_token; returned after Authorization
        request.setHeader('Authorization', AuthoriztionValue);
        request.setHeader('Accept', 'text/html, image/gif, image/jpeg, application/json');  
        request.setHeader('Prefer', 'outlook.allow-unsafe-html');
        String responsebody = (new Http()).send(request).getBody();
        RespBody= responseBody;

Here is the demo of the same built on Salesforce using Salesforce Sites. (

About Saurabh Dua


  1. can you Provide the sample visualforce and Apex code

  2. Hi Saurabh,

    Can you please share the code of Apex class and Vf if you have.My requirement is to sync outlook and salesforce. But it seems we can not use standard saleforce sync as it syncs only one way.Also,there are number of paid app but my client needs custom solution.Do you thing above solution works for my requirement.Can you please help me on this?

  3. Nice Blog, Thanks to share an amazing information with us, It helps me alot salesforce customer portal

  4. It is fine, nonetheless evaluate the information and facts around this correct.

  5. Thanks for another excellent post. Where else could anybody get that type of info in such an ideal way of writing? In my opinion, my seeking has ended now. Deepnude download

  6. It's very useful blog post with inforamtive and insightful content and i had good experience with this information. We, at the CRS info solutions ,help candidates in acquiring certificates, master interview questions, and prepare brilliant resumes.Find top Salesforce admin interview questions in 2020.
    These Salesforce developer interview questions are highly helpful in 2020. You can read these Salesforce lightning interview questions and Salesforce integration interview questions which are prepared by industry experts.

  7. I visit your blog regularly and recommend it to all of those who wanted to enhance their knowledge with ease. The style of writing is excellent and also the content is top-notch. Thanks for that shrewdness you provide the readers! microsoft office 2016 product key

  8. Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for. ms office 2016 free download full version

  9. Hello Saurabh , This article looks so helpful. I needed fully custom solution for outlook integration to salesforce , Just wanted to make sure that does this work the same way
    2nd question is that can we change visual force page url with lightning page url.
    Looking for reply, Thank you!!

  10. Hi! This is my first comment here so I just wanted to give a quick shout out and say I genuinely enjoy reading your blog posts. Can you recommend any other Beauty Guest Post blogs that go over the same topics? Thanks a ton!


Powered by Blogger.