In Part 1 of this series, we established secure connectivity between SAP CPI and SharePoint using Azure AD and OAuth 2.0 authorization code. With this foundation in place, we’re now ready to create an API that allows external applications to upload files directly to SharePoint through SAP CPI. This API, when exposed via API Management (APIM), can serve as a bridge for boundary applications to seamlessly push files to SharePoint.
This is part two of the three-part blog series which will guide us through the essential steps for SAP CPI and SharePoint integration:
This post will walk you through setting up a custom HTTP endpoint in CPI, configuring it to handle file uploads, and exposing it through APIM for external access.
Step 1: Design the Integration Flow in CPI
First, we’ll create an integration flow in CPI to handle file uploads. This flow will serve as the core of our API, receiving files from external systems and forwarding them to SharePoint.
We are not gonna go through the nitty gritty on how to create an Integration Flow but in the below section focus on the configurations more specific to SharePoint.
Create a New Integration Flow
Update the Maximum File Size from default of 40 MB to the maximum file size expected in the conditions tab of the HTTP adapter.
Set Content-Type as "application/octet-stream" using a Content Modifier.
Set the Message Body as the Body of the original HTTP request created as an exchange property which will be a binary stream data of the file uploaded.
Add the below details in the SharePoint Adapter to upload the files.
Please make sure to select Authentication Type as OAuth2 Authorization Code.
Step 2: Testing the Integration Flow
We can test the above integration flow from postman .
As shown in the below screenshot we are sending the Customer Number , Order Number and File Name as part of the HTTP header.
Request
Response
As you can observe below based on the File Path i.e. "/CUST-${header.CustNo}/ORD-${header.OrderNo}" mentioned in the adapter the SharePoint adapter automatically created the folder structure and placed the file in the last folder.
If the folder structure already exists it uploads the file to the target folder without creating duplicate folders.
While the general process of creating APIs in APIM has been covered extensively in other blogs, here we’ll focus specifically on configurations tailored for SharePoint integration.
You can refer to the below blogs if you need more info on the same.
We’ll also address how to handle large data uploads by enabling streaming, which not only enhances performance but also bypasses APIM's default 10 MB size limit. These adjustments are crucial when working with file uploads to SharePoint, where larger files are often encountered.
Add the below property to both Proxy End Point and Target End Point to enable the APIM to handle streaming of large amount of data.
In this second part of our series, we’ve set up a custom API in SAP CPI to upload files to SharePoint and exposed it securely through API Management. This API enables boundary applications to send files directly to SharePoint, expanding the integration’s reach. In the final post, we’ll dive into how to retrieve and manage files from SharePoint using the Microsoft SharePoint sender adapter in CPI, along with post-processing actions. Stay tuned for Part 3, where we bring the integration full circle!
Resources
Enable Streaming of Requests and Responses in an API Proxy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
6 | |
5 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 |