Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
PratyushPatra
Explorer
2,852
Hi all,

Recently I have got a requirement to integrate SAP CPI with OneDrive.The requirement is the sender system would send an excel file in .xlsx format and I need to add that excel file inside a folder in the OneDrive.

 

Microsoft Graph is a Microsoft API developer platform that connects multiple services and devices.

Prerequisites:

  • OneDrive Service Account(Personnel/Business) with application Developer role.

  • Create application in Microsoft Application Registration Portal.

  • Create a client secret.

  • Add API permissions to authorize our app to access OneDrive.


Set Up in OneDrive

Step-1


Step-2


Step-3


Step-4


Step-5


Step-6


Step-7


Step-8


Step-9


Step-10


 

Set Up in Integration Flow

I need to send the excel files to this folder


In my flow the excel file is coming to me as a base64 encoded format from the sender through process direct adapter.


 

Step-1

Create a header to set Content-Type as application/x-www-form-urlencoded


Step-2

Create a property to store the incoming payload.


Step-3

Set Client ID,Client Secret and grant-type =client_credentials for basic auth.


Step-4

Create a property for storing the base url-https://login.microsoftonline.com


Step-5

Add a request reply and in address put the OAuth url generated in Graph api it looks like baseurl/dqjscbejhcbe2hbcbehdbqhjvcewvceecwvh/oauth2/v2.0/token


Step-6

The response would be in JSON format so we require to convert it to XML for further processing.So , here we add a JSON to XML Converter.

Step-7

After this add a Content modifier to store the bearer token in a property.


Step-8

Then again add a content-modifier with setting headers and setting the original payload that we stored in a property.



Step-9 

Now we will send the data to OneDrive using the api in the format

https://graph.microsoft.com/v1.0/sites/{baseurlofonedrive}/drives/root:/{Folder_Name}/{filename}.xls...

And also pass the Bearer header that we created in the request reply.


 

SUMMARY

Finally after deploying the artifact and giving input as the excel file via postman the file is uploaded to sharepoint.

 
Labels in this area