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: 
alexkowalczuk
Explorer
14,104

Dear Community,


In this blog we will develop an SAP BTP Integration Suite iflow which will use SharePoint adapter. The aim of this blog is to showcase a common scenario to upload files to the Microsoft SharePoint system.


Introduction:


Use Microsoft SharePoint adapter to encrypt and exchange sensitive business data between trading partners. The Microsoft SharePoint Adapter connects an SAP Integration Suite tenant to a remote system using the HTTP protocol to write files to the system. Microsoft SharePoint adapter helps to use various product features from SharePoint Online like Sites, Subsites, List, List Items, Files, Folder, Column, Content Type, Permission, Sharing etc.


Main:


I have created and designed a bespoke iFlow, complete with a configuration that is readily accessible for your review as outlined below.


 

 

The initial step necessitates the creation of OAuth Client Credentials within the Security Material. To obtain the Client ID and Client Secret, it is necessary to access your Microsoft Azure account.



 

Within the Content Modifier, it is essential to specify the Message Header, Exchange Property, and the content of our Message Body intended for transmission to SharePoint.


Message Header:



Exchange Property:



 


Message Body:


 



 


Microsoft SharePoint Adapter Configuration:


In this step, it is crucial to configure the Microsoft SharePoint Connection and processing. This entails acquiring details such as the site host name (yourhostname.sharepoint.com), server path (/Documents/folder), and authentication type (in our case, OAuth2). Additionally, within the processing phase, one must select the operation group (e.g., files, list, sites) and the specific operation (e.g., upload file, track for changes). In the context of this example, we are creating a file and subsequently uploading it, necessitating the selection of a directory and the assignment of a suitable file name.




 

Processing:



 


  


Conclusion:


In this article we successfully posted a file to Microsoft SharePoint using built-in adapter.
Please feel free to ask any questions you have in the comments section below.


Links:
https://help.sap.com/docs/integration-suite/sap-integration-suite/microsoft-sharepoint-adapter

18 Comments
sayed42
Explorer
0 Kudos

Hi Alex,

Thanks for sharing such a wonderful blog, But I need to confirm what I supposed to add in the token service URL for OAuth2 Client Credential. For example My tenant is: https://xyz.sharepoint.com then what would be my token service URL for that please let me know.

Thanks,

Sufiyan

Joel_B
Explorer
0 Kudos

I cannot tell you how much I really appreciate this blog post!  I had been working on reading lists from SharePoint 365 over graph for months!  This new adapter works and I can return a SharePoint list.  Thank you for taking the time to write this!

hemalatha2022
Explorer
0 Kudos

Hi Joel, 
Could you please guide in letting know what should be given in the token service URL ?

 

Joel_B
Explorer

Hello hemalatha2022,

Sure. Though, to answer your question, I should tell you the specifics of my requirement.  I have setup Delegated, verses Application, authentication over Microsoft Graph.  

Authorization: https://login.microsoftonline.com/(Your Tenant GUID)/oauth2/v2.0/authorize

Token Service URL: https://login.microsoftonline.com/(Your Tenant GUID)/oauth2/v2.0/token

Scope: https://graph.microsoft.com/.default offline_access

 

Puneet1
Discoverer

Hi Alex,

This is informative blog. 

What would be the corresponding steps on Microsoft's end to complete this setup (creation of secret, token, granting access to specific sharepoint, etc). 

 

Thanks,

Puneet

Chadha__
Explorer

Hello,

From where can I get the ClientID and the Client Secret please 

 

bdBais
Explorer
0 Kudos

I notice, like amazon adapter too, there is no implementation with Poll Enrich to get a file inside a flow.

There is some future update with this feature?

siddhartha_routh
Explorer
0 Kudos

Hi @alexkowalczuk 
Thank you for this excellent blog. 
Can you please expand on the content modifier body that was passed as payload in the SharePoint adapter. Was it in binary format ? I saw a JSON as constant in the body, how was the file actually uploaded. 

Jyothi5
Newcomer
0 Kudos

Hi @alexkowalczuk 

Even I do also have the same question as siddhartha_rou24

What has been passed as body and how exactly file has been uploaded on the SharePoint ?
Can you please give us the light on that ?

 

 

0 Kudos

Thank you for this blog, we too are struggling to ask the right questions to obtain the clientid/secret from the Azure account for a particular folder, including the Token URL.

 

robert_solomons2
Explorer
0 Kudos

Hi , 

 Initially the implementation worked well but lately I am getting intermittent errors . 

  LastError           = com.sap.adapters.factory.sharepoint.exception.SharePointException: Problem during retrieving the access token for the OAuth2 client credential HTTPReceiverSharePointCreateFolder: java.lang.NullPointerException: while trying to invoke the method com.sap.esb.security.TrustManagerFactory.getTrustManagers() of a null object loaded from local variable 'trustManagerFactory', cause: java.lang.NullPointerException: while trying to invoke the method com.sap.esb.security.TrustManagerFactory.getTrustManagers() of a null object loaded from local variable 'trustManagerFactory'

Based on the error above it seems like adapter is unable to retrieve the credentials from the security materials or the adapter is unable to retrieve a token from the Microsoft token engine. 

Has anyone else experience this problem. Any suggestions would be appreciated .

Thank you .

Robert 

taufikanang
Discoverer
0 Kudos

Hi Alex

I follow your way, but getting this error "InvalidAuthenticationToken - Access token validation failure. Invalid audience".

Any properties of OAuth2 Client Credential working well using postman. But, get above error when applied in security material.

Kindly help for this bloody stuff.

robert_solomons2
Explorer
0 Kudos

Hi All , 

Just an update on my issue below.  

LastError           = com.sap.adapters.factory.sharepoint.exception.SharePointException: Problem during retrieving the access token for the OAuth2 client credential HTTPReceiverSharePointCreateFolder: java.lang.NullPointerException: while trying to invoke the method com.sap.esb.security.TrustManagerFactory.getTrustManagers() of a null object loaded from local variable 'trustManagerFactory', cause: java.lang.NullPointerException: while trying to invoke the method com.sap.esb.security.TrustManagerFactory.getTrustManagers() of a null object loaded from local variable 'trustManagerFactory'

Further investigation indicated that the request to access the security materials failed (credential store) only on Instance ID 0.

In addition to this I was unable to deploy any artifacts. 

The SAP dev ops team restarted the instances to free apparent locks that was visible to them.  Latest update from SAP - investigating root cause and will get back to you. 

Regards 

Robert 

 

yasithal
Discoverer
0 Kudos

I'm getting the error "Access token validation failure. Invalid audience". Any idea why?

TulasiramD
Discoverer
0 Kudos

@ALL @Tau @yasithal @taufikanang 

Does anyone able to resolve below error?

InvalidAuthenticationToken","message":"Access token validation failure. Invalid audience

It would be a great help if you provide the solution for this issue.

 

Thanks,

Ram.

bdBais
Explorer
0 Kudos

I've asked to Cloud AI:

 

I can help you troubleshoot the SharePoint API authentication error. The "Invalid audience" error typically occurs when the token's audience (aud claim) doesn't match what SharePoint expects.

For SharePoint Online API calls, here are the common solutions:

1. Make sure you're using the correct resource/audience URL:
```
https://{your-tenant-name}.sharepoint.com
```

2. Check your authentication code. Here's a basic example using Microsoft Graph authentication:

```python
from msal import ConfidentialClientApplication

# Configure your app
app_config = {
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"authority": "https://login.microsoftonline.com/YOUR_TENANT_ID",
"scope": ["https://YOUR_TENANT.sharepoint.com/.default"]
}

# Create MSAL app instance
app = ConfidentialClientApplication(
app_config["client_id"],
authority=app_config["authority"],
client_credential=app_config["client_secret"]
)

# Get token
result = app.acquire_token_silent(app_config["scope"], account=None)
if not result:
result = app.acquire_token_for_client(scopes=app_config["scope"])
```

To help debug this further, could you share:
1. Which authentication method you're using (Client Credentials, Authorization Code, etc.)?
2. How you're obtaining the access token?
3. The scope(s) you're requesting in your token?

TulasiramD
Discoverer
0 Kudos

Hi @bdBais 

Please see my comments below.

1. Which authentication method you're using (Client Credentials, Authorization Code, etc.)?

I am using OAuth2 Authorization Code


2. How you're obtaining the access token?

Accessing sharepoint server by using user credentials provided.


3. The scope(s) you're requesting in your token?

https://{your-tenant-name}.sharepoint.com/.default

 

Thanks,

ram.

KrushnaBand
Discoverer
0 Kudos

Hello All,

Please modify OAuth2 Client Credentials as shown in screenshot. It should work.

KrushnaBand_0-1736510242795.png


BR,
Krushna Band 

 

Labels in this area