Skip to Content
Technical Articles

Part 2: Posting Documents to SharePoint :Create SharePoint Connector Instance in Open Connectors

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.

  • 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

11 Comments
You must be Logged on to comment or reply to a post.
  • 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?

  • 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.

     

     

    • Hi Jörg 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

       

  • 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

    • 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

       

      /
      • 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

        /
        • 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

    • 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