ABSYZ ABSYZ

  • Home

    Home

  • About us

    Who We Are

  • Our Expertise

    What we Do

  • Our Approach

    How We Do It

  • Products

    What We Made

  • Industries

    Who We Do It For

  • Clients

    Whom We Did It For.

  • Article & Blogs

    What Experts Think

  • Careers

    Join The Team

  • Get In Touch

    Let’s Get Started

ABSYZ

Integrate SharePoint with Salesforce using Microsoft Graph API

Home / Article & Blogs / Apex / Integrate SharePoint with Salesforce using Microsoft Graph API
By Prasenjeet Banerjee inApex, Integration, Salesforce
Effective Steps in integrating Sharepoint with Salesforce.

Why Integrate with SharePoint?

One of the main reasons is the revenue cost. With SharePoint integration, an organization can save a lot in Salesforce’s storage costs. A standard SharePoint storage is 1 TB. If that is not enough, extra storage is available at a very reasonable price of $0.20/month per GB (exact plans are available online).

Getting Familiar With SharePoint Terms

  1. Tenant: A tenant represents an organization. It’s a dedicated instance of Azure Active Directory received after signing up for Microsoft Azure account.
  2. Site: It is a website that contains different SharePoint Web components like Document Library, Calendar, Task List, etc. There can be multiple Sites under a single Tenant.
  3. Document Library: A secure place to store files related to a specific project or a client so as to collaborate among co-workers.
  4. Drive: The drive resource is the top-level object representing a user’s OneDrive or a document library in SharePoint.
  5. Drive Item: The driveItem resource represents a file, folder, or other item stored in a drive.

Prerequisites

Before we start writing Apex classes to make callouts, we need few basic information to communicate with SharePoint. It is advisable to seek help from the SharePoint admin team for carrying out the steps mentioned below.

  1. Login to Microsoft Azure account.

    Click on Azure Active Directory.
  2. Create an app in the Azure Portal for the Tenant.

    Click on App registrations on the left panel.

    Click on New registration.

    Enter the App name and select the options as shown in the image.
    Click on Register.

    Note down the Client Id and Tenant Id.
    Click on Authentication from the left panel.

    Click on Add a platform. Select Web.
    Enter the Redirect URI as your Salesforce org domain.
    Ex: https://<domain-name>.my.salesforce.com

    Ensure the checkboxes shown in the image are checked.
    Click on Certificates & secrets.

    Click New client secret. Once generated, note down the Client Secret value.
  3. Request for API permissions (usually granted by SharePoint admin)

    Click Add a permission. Select Microsoft graph. Select the permissions as shown above for Delegated and Application permissions.
    Note: Delegated permissions are for user based API requests and Application permissions are temporary access token based API requests. For Application permissions, SharePoint Admin should grant explicit access.
  4. Create a SharePoint Site where the documents need to be stored and note down the SharePoint Site Id by hitting this URL in the browser: https://<tenant>.sharepoint.com/sites/<site-url>/_api/site/id

Integration using Microsoft Graph API

Microsoft Graph API exposes various endpoints where requests can be sent over HTTP protocol. It uses the REST API standards and its online documentation is readily available for development, as a result of which we have more control on the SharePoint side.

Once all the prerequisites have been met, we need to prepare our Salesforce Org to integrate with the SharePoint App that we created.

  1. As a best practice, store Tenant Id, Client Id, Client Secret in a Custom Metadata record in Salesforce for making callouts. Specify the name of the record as Azure_App for ease of identification. Store Azure Grant Type=client_credentials, Azure Scope=https://graph.microsoft.com as static values in the same record as they will be the same for all callouts.
  2. Create two Remote Site Settings:
    1) Name=Microsoft_Graph, URL=https://graph.microsoft.com
    2) Name=Microsoft_Login, URL=https://login.microsoftonline.com
  3. Create an Apex class to make callouts.
    Firstly, we need a temporary access token to be specified in the HTTP request header to make any callouts.


    All the necessary details are fetched from the Custom Metadata record and a POST request is made with required URL parameters to fetch the access token.

    Every subsequent callout should hold these request headers. Note that the Authorization header has the value Bearer <space><access_token>.

    Assuming you have a custom component to upload file and convert the file data to bae64 string, the next step is to form the parameters as shown above and call the method in order to make a callout to SharePoint endpoint.

    To create a folder as shown above, pass the required parameters and make a callout.

Key Takeaway

Using the Microsoft Graph API we can create Salesforce components to Read the entire document library, Create folders, Upload files, Download files from SharePoint.

Files connectMicrosoft Graph APISalesforceSalesforce IntegrationSharePointSharePoint Integration
205
Like this post
1 Post
Prasenjeet Banerjee

Search Posts

Archives

Categories

Recent posts

Meet OmniStudio – Revolutionize Your Creative Work

Meet OmniStudio – Revolutionize Your Creative Work

BioAsia 2023 in Hyderabad: An Annual International Event

BioAsia 2023 in Hyderabad: An Annual International Event

The Role Of Marketing in Small & Medium Enterprises

The Role Of Marketing in Small & Medium Enterprises

Salesforce For Retail: How Salesforce CRM Can Help Retailers

Salesforce For Retail: How Salesforce CRM Can Help Retailers

What is ChatGPT & How Does It Work?

What is ChatGPT & How Does It Work?

  • Luminate CRM is retiring, what should your Non-Profit do now? What are Luminate CRM Alternatives?
    Previous PostLuminate CRM is retiring, what should your Non-Profit do now? What are Luminate CRM Alternatives?
  • Next PostWhy choose Salesforce Integration Partners?
    Luminate CRM is retiring, what should your Non-Profit do now? What are Luminate CRM Alternatives?

Related Posts

Meet OmniStudio – Revolutionize Your Creative Work
Salesforce

Meet OmniStudio – Revolutionize Your Creative Work

Salesforce For Retail: How Salesforce CRM Can Help Retailers
Salesforce

Salesforce For Retail: How Salesforce CRM Can Help Retailers

Introduction To Copado Devops Tool
Salesforce

Introduction To Copado Devops Tool

What is Salesforce Code Builder?
Salesforce

What is Salesforce Code Builder?

Leave a Reply (Cancel reply)

Your email address will not be published. Required fields are marked *

*
*

ABSYZ Logo

INDIA | USA | UAE

  • About us
  • Article & Blogs
  • Careers
  • Get In Touch
  • Our Expertise
  • Our Approach
  • Products
  • Industries
  • Clients
  • White Papers

Copyright ©2022 Absyz Inc. All Rights Reserved.

youngsoft
Copy
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “ACCEPT ALL”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent. Privacy Policy
Cookie SettingsREJECT ALLACCEPT ALL
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled

Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.

CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.

Functional

Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.

Performance

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

Analytics

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.

Advertisement

Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.

Others

Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.

SAVE & ACCEPT