Skip to Content
Author's profile photo Dilip Kumar Krishnadev Pandey

Integrate SharePoint using SAP PI

Overview:

Here, we will see how we can integrate with SharePoint to Read/Write data using SAP-PI techniques without REST-Adapter.

We can interact remotely with SharePoint data using any technology/platform which supports REST (Representational State Transfer service) web requests.

SharePoint provides specific REST-API-protocols which can be used for data exchange with SharePoint. We can perform CRUD operations (Create, Read, Update, and Delete)

A RESTful API is an application program interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data (real time data exchange over internet).

For any data exchange with SharePoint via respective REST-API, we need to follow following steps:

  1. Get “SharePoint access token” for authroization
  2. then perform CRUD (create/Read/Update/Delete) operations using POST/GET/PUT/DELETe methods.

For authorization, to fetch “SharePoint access token”, we need following SharePoint details:

  1. Client-Id or App-Id:          Client ID is a GUID for the SharePoint Add in
  2. Tenant-Id:                        Tenant ID is SharePoint Online Site Realm
  3. Client-Secret:                  Client Secret is the password for the add-ins.

And while fetching “SharePoint Access Token”, we may get following permission issue:

  • “Access denied. You do not have permission to perform this action or access this resource”

To resolve above issue/error, we need to provide “Write” permission to our SharePoint client-id/app-id with below xml input in SharePoint:

  • <AppPermissionRequests AllowAppOnlyPolicy="true">
        <AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="Write" />
    </AppPermissionRequests>

and to do this (granting write-permission) in SharePoint site for our client-id/app-id, we can follow following Microsoft-help-link and screen:

 

In SAP-PI where REST Adapter is not available (say till version SAP-PI 7.1), then without REST-Adapter, following techniques can be used in SAP-PI to consume SharePoint-REST APIs for data Exchange:

  1. Using SAP-PI Java UDFs (User defined functions)

  2. Using SAP-PI Java Maps

 

Please Note:

  • The purpose of this blog is to club all my blog’s info written for SharePoint integration.
  • This blog will be kept on updating with new SharePoint techniques using SAP-PI as soon as it comes in my integration journey path
  • Next plan is try “OAuth 2.0 authentication” using std. REST Adapter

….to be continued

Assigned Tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo ahamad shaik
      ahamad shaik

      Dilip Kumar KrishnaDeo Pandey

       

       

      Nice blog keep On  🙂

      Author's profile photo Amiya Krishna
      Amiya Krishna

      I was trying to Get a  PDF file from sharepoint using swift webview and jamfkeychain , problem I am facing is that the SAP Sharepoint login screen is rendered rather the PDF. What pass through to use, can you help.

      Author's profile photo Dilip Kumar Krishnadev Pandey
      Dilip Kumar Krishnadev Pandey
      Blog Post Author

      Hi Amiya,

      To read SharePoint files, I hope you must be using correct respective REST API.

      I have one example where .txt file was read as can be referred in below blog link, please check:

      https://blogs.sap.com/2018/02/01/consume-sharepoint-rest-to-create-a-file-using-java-sap-pi-udf/

      refer section "[1] JavaCode to retrieve all files of a folder from SharePoint:"

      Thanks & Regards,

      Dilip K K P

      Author's profile photo Michael Sargent
      Michael Sargent

      Thanks Dilip.  I acknowledge your help and an article on global-sharepoint.com where the fields to be used are explained in detail. In 4 steps access SharePoint online data using postman tool | Global SharePoint Diary (global-sharepoint.com)

      I have been successful in connecting to SharePoint from PO 7.5 using the REST OAuth 2.0 adapter with zero coding and to create a folder in SharePoint.

      It looks like SharePoint ignores the fields "Client ID:" and "Client Secret:" as these have to be supplied as Additional Parameters.  Please take not of the Parameter Types.  These dictate whether they are send in the http header or in the URL.  The example below works.

      Screen%20shot%20of%20OAuth%20settings

      Screen shot of OAuth settings

       

      Since I want the response in xml, I set Accept xml, but you can use json.

      Screenshot%20of%20HTTP%20Headers

      Screenshot of HTTP Headers

       

      Author's profile photo Dilip Kumar Krishnadev Pandey
      Dilip Kumar Krishnadev Pandey
      Blog Post Author

      Hi Michael,

      Thanks for sharing the information, I will surly try from my side using REST-Adapter.

      I had explored the Java-Program techniques because, from one end, I had to invoke a API to get the pendingCounts of employees and on other end, sending the count to Sharepoint via PI7.1 where REST adapter was not present. Now, we have PO7.5, so it's good to explore REST adapter with Sharepoint-APIs

      Thanks & Regards,

      Dilip