Salesforce and Office 365 Integration step by step

In this post I will show how to integrate Office 365 Documents in Sales force.

Requirement is to view Office 365 Documents from sales force.

Steps can be categorized as:

  1. Sign up for Sales force trial account.
  2. Enable Files Connect option in sales force.
  3. Create Auth.Provider in sales force.
  4. Create External Data Source in sales force.
  5. Sign up for Office 365 trial account.
  6. Create Document Library and upload Documents.
  7. Register an APP in Azure web site(sign up if not available) for sales force.
  8. Browse through the Office 365 Documents from sales force.

All you need to have is Office 365 Site, Azure web site and Sales force Instance Trail accounts.

  1. Login to Salesforce

SalesforceLogin

2. Enable Files Connect feature by searching File connect from search box from Setup page.

Files Connect allows you to connect Sales force to your Enterprise Content Management (ECM) system.

Currently supported ECM systems are:

  • SharePoint 2010 & 2013 on-premises.
  •  SharePoint Online.
  •  OneDrive for Business.
  •  Google Drive
  •  Box

sf2

Edit, enable the Files Connect check box and Save. Files connect settings has two Sharing methods. Copy and Reference. Choose any one as per your requirement.

choose copy if you want files to be copied between the two systems.

choose Reference if you want just reference to files instead of copies.

Go to Permission Sets and give permission.

sf13

click on edit add File connect cloud, add and save.

sf14.png

3. From Setup key in Auth.Provider in search box and create new Auth. Provider

Choose following:

Provider Type: Open ID Connect

Name: SPAuthProvider

URL Suffix: SPAuthProvider

Consumer Key: SPAuthProvider

Consumer Secret: SPAuthProvider

Authorize End Point URL: https://

Token End Point URL: https://

Remaining fields leave as default and save. All the above field should be edited later according to upcoming steps.

sf3

Click on save. * Note down the call back URL to register this in Azure web site.

4. Create Azure web website, if not, sign up under https://manage.windowsazure.com/

sf6

5. Create Office 365 Site Collection, if not, sign up under https://login.microsoftonline.com/ . Create site collection and upload some Documents into Documents library.

sf5.png

6. Go to Azure web site and choose Active Directory, choose App registrations and click on New Application Registration.

sf7.png

Enter Name, Application Type-Webapp/API, sign on url – provide site collection url and click on create.

sf8

Click on created application note down Application ID and Object ID.

Under Reply URLs, add sale force Call back URL that was generated in Salesforce.

https://login.salesforce.com/services/authcallback/00D7F000004A1WuUAK/SPAuthProvider

under Owners, add owner for this app.

Note: The user in Salesforce and Office 365 should be same. if not create users/groups accordingly if needed in both salesforce and office 365.

Under Permission, delete the existing and grant/ create new one with the required permissions

sf9.png

Under keys, provide Description, expiration and click on save. value will be auto generated and note it down separately. This value cannot be view further so be sure to note the value.

7. Now go back to salesforce and edit the Auth.Provider and provide all the details like Consumer Key, Secret, Authorize End Point URL, Token End Point URL etc.

Consumer key is nothing but Application ID generated in Azure.

Consumer secret is the value generated under keys expiration.

Authorize end point URL:

The format is “https://login.microsoftonline.com/common/oauth2/authorize?resource=https%3 A%2F%2F[YOUR_COMPANY_NAME].sharepoint.com&prompt=login”

eg: https://login.microsoftonline.com/common/oauth2/authorize?resource=https%3A%2F%2Ftestsoftindia.sharepoint.com&prompt=login

Token end point URL: https://login.microsoftonline.com/common/oauth2/token

sf11.png

sf10

Click on Save.

8. Go to External Data Sources and create new Data Source with following details.

sf12.png

It will ask for SharePoint Online credentials. Once provided authentication, asks to trust the application, once trusted, Status will be changed to Authenticated from Pending.

9. Create External Object the external data source like below.

sf15.png

Validate and sync

sf22.png

10. From Permission set page,

sf16

choose external data source access.

sf18.png

click edit and add data source and save.

sf19.png

11. go to app launcher, and click on files.

sf20.png

12. under connected source, you will be seeing Office 365 files

sf21.png

clicking on document title will take the user to office 365 site.