Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
divyamary
Contributor
Many a times, the billing documents like invoices or sales orders which is available as a PDF document needs to be copied to SharePoint team site so that it can be made accessible to broader recipients within an organization. Using the OData APIs available in SAP S/4HANA Cloud, integrations patterns provided by Cloud Integration capability and simplified connectivity to SharePoint provided by Open Connectors of SAP Cloud Platform Integration Suite, such a business scenario can be very easily achieved.

In the blog series, posting of the billing documents from SAP S/4HANA Cloud to SharePoint is covered end-to-end and in this blog, configurations around creating a SharePoint connector instance via Open Connectors is covered.

Prerequisites



App Registration for SharePoint API Access


For using the SharePoint connector from Open Connectors capability of SAP Cloud Platform Integration Suite, you will need an OAuth key and Secret to connect to your SharePoint Online account. In this section, configurations required to connect to your SharePoint Online account has been covered.

  • Logon to your Azure Portal using your SharePoint online credentials.

  • Navigate to Azure Active Directory and select App Registrations. Click New registration to create an OAuth application.




 

  • In the application registration prompt, enter an application name say SharePointOAuthApp, select the supported account types and in the Redirect URI enter the redirect URI for SAP Cloud Platform Open Connectors, which is https://auth.cloudelements.io/oauth




 

  • The registered application by default only has the User.Read permission from Microsoft Graph APIs and you will need to add in the required permission to access SharePoint REST APIs. Select API permissions tab and then click on Add a permission to add in the permissions for SharePoint REST APIs.




 

  • Select SharePoint to add in the API permissions for SharePoint.




  • In SAP Cloud Platform Open Connectors, access to the API is via the signed-in user. Select Delegated Permissions for accessing APIs as signed-in user.




  • Select the Permissions as shown in the screenshot below and select Add permissions




  • Some of the selected permissions would require administrator consent.  After the permission is selected, click on Grant admin access .  The permission may take some time to updated as shown in the warning, so wait for few minutes before selecting the Grant admin consent option.




  • You may be prompt to confirm the administrator consent. Select Yes.




  • After successful operation, the status would change to Granted for your user.




  • For connecting to your SharePoint Online account from SAP Cloud Platform Open Connectors, OAuth secret is required.To get your OAuth Secret, select Certificates & secrets tab, click on New client secret.




 

  • Enter a description for your OAuth secret say oauthsecret, select the expiry time, select Add.




  • Copy and note down the generated client secret, you will need to provide this while creating SharePoint connector instance from SAP Cloud Platform Open Connectors.The generated client secret cannot be retrieved later.




 

  • For connecting to your SharePoint Online account from SAP Cloud Platform Open Connectors, OAuth client ID is required.To get your OAuth client ID , select Overview tab, copy the Application (client) ID value.




 

Create SharePoint Connector Instance in Open Connectors


Open Connectors capability of SAP Cloud Platform Integration Suite simplifies and accelerates connectivity to third-party cloud applications. It provides robust, feature rich, pre-built connectors to an extensible library of over 160 of the most popular third-party cloud applications. In this section, steps to create SharePoint connector instance from Open Connectors capability of Integration Suite is captured.

SAP Cloud Platform Integration Suite is available for test, explore and try out in SAP Cloud Platform trial. If you have not enabled SAP Cloud Platform Integration Suite in your trial tenant, refer this blog to enable it.

 

  • Logon to your SAP Cloud Platform trial

  • Select Subscription and search and select Integration Suite. Click on Go to Application



 

  • It will launch the Integration Suite launch pad in a new browser tab. Select Extend Non-SAP Connectivity In case this option is not visible for you, you can click on Manage Capabilities and enable Open Connectors capability. More details in this blog



 

  • You would be navigated to Open Connectors Home page.




  • Click on Connectors tab to view all the available pre-built, feature rich connectors. Search for the SharePoint connector by entering Shar in the search region.

  • Hover over the Sharepoint connector and select the option Authenticate to connect to your own SharePoint account.



 

  • In the connection wizard, enter a name for your connector instance say mysharepointdemo, Enter your Sharepoint Site Address in the format {your_sharepoint_domain}.sharepoint.com, enter your copied OAuth Client ID in the API Key text field, enter your copied OAuth secret in the API Secret text field and select Show Optional Fields.





  • During the creation of OAuth Client & Secret on Microsoft Azure portal since the delegated user access approached was used, select the Delegate User access flag to true in Open Connectors as well.

  • Select Create Instance to create SharePoint connector instance.





  • You may be prompted to enter your SharePoint user credentials. In case, you are already logged into your SharePoint account the logged in session may be automatically taken by the browser.






  • You may be prompted to trust the SharePoint OAuth application. Select Trust It




  • After the authenticated connection to your SharePoint account has been created successfully you would be able to test out the connection from SAP Cloud Platform Open Connectors. To try out the SharePoint connector APIs, click on the option Test in the API Docs.




 

  • This would launch the integrated OpenAPI specification based API Documentation for your SharePoint connector, so that you can test and try out the connector from SAP Cloud Platform Open Connectors.

  • Select any of the available Resources say GET /files to read files from your SharePoint sites and click on Try it Out





  • To read files from SharePoint, the information about your teams site should be passed in the field Subsite in the format /sites/{your_site_name} and path to your file should be passed in the format /{your_directory}/{your_filename}. In this blog series, the name of SharePoint teams site used was General and name of the filename was docx. Enter /welcome.docx in the path field and /sites/General in the Subsite field. Select Execute.


Note:- If your site contains spaces then in the Subsite field enter the site name without spaces.




  • Click on the Download file to download and view your file from SharePoint To view the downloaded word or office files appropriate software on your local machine will be required.



 

  • To consume this newly created connector instance from Cloud Integration, copy down the connectors instance authorization token and the Request URL.



With this you have successfully created a SharePoint connector instance from Open Connectors capability of SAP Cloud Platform Integration Suite. You would be able to use this connector instance in Cloud Integration to integrate data from SAP system to SharePoint or build an application connecting to your SharePoint account. In the next blog part of the Blog Series Posting Documents to SharePoint , steps to consume this SharePoint connector instance from Cloud Integration will be covered in details.

More information about Pre-built connectors features like normalized search, pagination, bulk, eventing is available in help documentations

To know more about Open Connectors visit us at SAP Community
14 Comments
0 Kudos

Thank you for sharing so important information. But, unfortunately, there is no information about SharePoint user propagation.
If I,
– register an open connector by SharePoint “user1”
– create destination in SCP Cloud Foundry forwarding requests to the open connector
– create Fiori app able to create folders using the destination
– “user2” creates folder in SharePoint using the Fiori app

Who will be the folder creator in SharePoint?

joerg77_wischnewski
Discoverer
0 Kudos
Thank you for the great blog. We configured SharePoint online as described and for the most APIs it´s working. Do you have an idea why we are not able to execute POST files/copy? We are always getting - error 500.

curl -X POST "https://api.openconnectors.ext.hana.ondemand.com/elements/api-v2/files/copy?path=%2FGeneral%2FIMPORT_DEV%2Ftest.xlsx" -H "accept: application/json" -H "Authorization: User xxxxx, Organization xxxxx, Element xxxxx" -H "Content-Type: application/json" -d "{ \"path\": \"/General/IMPORT_DEV/Folder1/test.xlsx\"}"

Response body:

{
"requestId": "5ef453dbe4b0cf6d8efc1208",
"message": "Failed to copy file in document provider."
}

Also interesting: Creation of the not existing folder <Folder1> works as described in API documentation.

 

 
divyamary
Contributor
0 Kudos
Hi joerg77.wischnewski

Thanks a lot of kind words on the blog and glad to hear that you found blog use.

Thanks for bringing the issue of Copy feature & Creation when the folder doesn't exist to our notice, we would appreciate a lot if you could create a customer support ticket on our component LOD-OCN-OPS so that our product engineering team can have a look into your issue and assist you with a quick resolution.

Thanks and Best Regards,

Divya

 
joerg77_wischnewski
Discoverer
0 Kudos
Thank you for your reply. I have created SAP ticket. Once there is a solution available, I will post SAP note or solution here.
former_member228109
Participant
Hi Divya,

Thanks for sharing this. I am facing an issue while trying Get/files execution. I am getting "Invalid Organization or User secret provided" 401 unauthorized error. I am passing user= application ID/Client ID of share point, organization= OAuth secret of share point.

Could you please suggest correction to resolve this.

Regards,

Nikhil Save
divyamary
Contributor
Hi Nikhil,

You will need to pass in the authorization header generated by the SharePoint connector instance of Open Connectors . So when you will click on the tryout button in Open Connectors, you can notice that the authorization header is pre-filled for your SharePoint connectors instance. Pass this value from your application to connect to SharePoint connector instance of Open Connectors.

Thanks and Best Regards,

Divya

 

former_member228109
Participant
Hi Divya,

Thanks for your time.But when I am keeping pre-filled authorization header, I am getting 404 not found response.


 

Regards,

Nikhil Save
JSilva
Explorer
0 Kudos
Hi Divya,

Is there any chance to connect SAP ECC to SharePoint (office 365) using the tools that SAP provide ?
divyamary
Contributor
0 Kudos
Hi Nikhil,

Can you check if the path to the file that you would like read in your SharePoint folder is correct. Also check if the Subsite information as per your SharePoint set up is passed correctly.

In case you continue to face issue, kindly raise a customer incident on the component LOD-OCN-OPS so that our product development team can assist you.

Thanks and Best Regards,

Divya
divyamary
Contributor
0 Kudos
Hi Jorge,

You can leverage Open Connectors capability of SAP Cloud Platform Integration Suite to connect from your SAP ECC environment to SharePoint as well.

Once the SharePoint connector instance is created and you test it from Open Connectors UI, you will see the CURL command generated. This CURL command contains the API URL and the authorization token details which you can use to connect from SAP ECC system.

Thanks and Best Regards,

Divya
JSilva
Explorer
0 Kudos
It sounds like a very interesting idea. Thanks for the tip.

Best Regards,

Jorge Silva
0 Kudos

Hi Divya,


Thanks for the blog, It is really nice. We have a requirement to post / retrieve documents to from sharepoint using an SAPUI5 app.




  1. 1) I tried to use the GET request for download file in the postman tool, but in the response I am not able to download the file , Please refer the screenshot for the response.


Postman Request and Response for GET Request to download files



            2) Also, when I tried POST request for uploading a file in the open connector api, getting 502              Bad Gateway error.



While Posting a file to sharepoint in open connector API Integration Suite Trial


Thanks and Regards,


Swaroop Kumar Nagavarapu.

BrendanFarthing
Participant
0 Kudos
vavtonomov , did you ever get an answer to your question or find out how this works?

I was wondering the same thing. This would be one of the most important aspects in real life business use.

I'd like to know if the user from a Fiori app or SAP ABAP system can be propagated to Sharepoint so that the user who triggered the process would be validated in Sharepoint and allowed to modify the document folder if they had permission, or denied access in Sharepoint if they didn't have access.

I'd also like Sharepoint to record that user's name next to the document.

Thanks,

Brendan

 

 

 
pi_satishb
Explorer
0 Kudos

Hello Divya,

 

Thanks for your blog and I have followed it to Integrate shared point with SAP CPI using open connectors.

We are done with configuration at Azure end and when we try to create instance from open connector, getting the below message,

Sign in

Sorry, but we’re having trouble signing you in.

AADSTS50011: The redirect URI 'https://auth.cloudelements.io/oauth' specified in the request does not match the redirect URIs configured for the application '6f9cc5d5-999d-4c0a-a6d3-a57ed514de03'. Make sure the redirect URI sent in the request matches one added to your application in the Azure portal. Navigate to https://aka.ms/redirectUriMismatchError to learn more about how to fix this.
Troubleshooting details
If you contact your administrator, send this info to them.
Copy info to clipboard
Request Id: c62a7cf6-6dcd-4f32-b5a0-b750a78a4000
Correlation Id: 6eb217dc-bc08-4aed-8ade-7f7c97b8de4f
Timestamp: 2022-09-12T12:31:05Z
Message: AADSTS50011: The redirect URI 'https://auth.cloudelements.io/oauth' specified in the request does not match the redirect URIs configured for the application '6f9cc5d5-999d-4c0a-a6d3-a57ed514de03'. Make sure the redirect URI sent in the request matches one added to your application in the Azure portal. Navigate to https://aka.ms/redirectUriMismatchError to learn more about how to fix this.
Flag sign-in errors for review: Enable flagging
If you plan on getting help for this problem, enable flagging and try to reproduce the error within 20 minutes. Flagged events make diagnostics available and are raised to admin attention.
Regards,
Satish