Sharepoint Client Adapter

The SharepointClientadapter is a component of the Sterling B2B Integrator, allowing seamless connection with Microsoft Sharepoint.

Introduction

In Sterling B2B Integrator v6.2.0.1 and above, you can perform operations such as list, get, put, and delete files, make directory and document library using Sharepoint Client Adapter and Services on Sharepoint Site.

The Sharepoint Client Adapter has the following major features:

Sharepoint online uses throttling to maintain optimal performance and reliability of the Sharepoint online service. For more details on throttling, see Avoid getting throttled or blocked in SharePoint Online.

The following table provides an overview of the SharepointClientadapter:
Category Description
System name SharepointClientadapter
Graphical Process Modeler (GPM) category None
Description Sends Sharepoint requests to trading partners.
Business usage Use this adapter to send Sharepoint requests to perform activities such as to get or put files into a directory on Sharepoint.
Usage Example A business process is executed that sends or receives a file using Sharepoint site for a trading partner. The SharepointClientadapter is used to integrate with Sharepoint site.
Preconfigured? Yes, with default properties. You need to provide your specific values.
Requires third-party files? No
Platform availability All Sterling B2B Integrator supported platforms
Related services The following services are related. Configured in a business process, they initiate the SharepointClientadapter to perform their services:
  • Sharepoint Client Begin Session service
  • Sharepoint Client LIST service
  • Sharepoint Client MKDIR service
  • Sharepoint Client MKDOCLIB Service
  • Sharepoint Client PUT service
  • Sharepoint Client GET service
  • Sharepoint Client DELETE service
  • Sharepoint Client End Session service
Application requirements The SharepointClientadapter should be configured with the Sharepoint account, credentials, and document library for trading partner.
Initiates business processes This adapter does not initiate business processes.
Invocation This adapter is not invoked from a business process.
Business process context considerations Business processes using Sharepoint Client services should not be marked as Auto Resume. These services require an established session which will no longer exist after a restart.
Returned status values None
Restrictions All work bound within a Sharepoint Client Begin Session service and a Sharepoint Client End Session service must be within the same business process.
Persistence level N/A
Environment Supported Environments are:
  • ASI nodes
  • AC nodes
Note:
  • The SharepointClientadapter does not support all adapter container node environment. Instead, use specific nodes as a target environment.
  • When the SharepointClientadapter is hosted on an AC node, then JMS MQ should be configured.
  • Proxy configuration does not work on SharepointClientAdapter hosted on AC nodes. Proxy configuration works with ASI nodes only.
Testing considerations To test this adapter, run the SharepointClientDemoAllServices business process and verify that it completes successfully. For more information about the SharepointClientDemoAllServices business process, see Business Process Example of All Sharepoint Client Services. Debug information for this adapter is located at: Operations > System > Logs > Log.SharepointClient.

Implementing the SharepointClientadapter

To implement the SharepointClientadapter:
  1. Create a SharepointClientadapter configuration.
  2. Configure the SharepointClientadapter.

Prerequisites for Configuring the SharepointClientadapter

  1. A SharePoint site and a domain.
  2. A document library created in SharePoint.
  3. Ensure that Microsoft Entra is configured with the following:
    1. App registration,
    2. Site permissions for the SharePoint API,
    3. A public certificate to authenticate the registered app.
  4. Import this public certificate (3.c.) in the Sterling B2B Integrator Dashboard. To do this:
    1. Navigate to Trading Partner → Digital Certificates → System.
    2. Import the certificate as p12 file containing private key and certificate.
  5. Extract all the CA certificates (root, intermediate, and leaf) for your SharePoint site and import them in the Sterling B2B Integrator Dashboard. To do this:
    1. Navigate to Trading Partner → Digital Certificates → CA.
    2. Import the CA certificates to the Dashboard.

Importing CA Certificates for SharePoint Client Adapter

To configure CA certificates for secure SSL communication with SharePoint, follow these steps:
  1. Go to Microsoft Entra and log in with your credentials.
  2. View SSL Certificates
    You can view and download the SSL certificates using Firefox:
    • Click the lock icon on the left of URL bar.
    • Select Connection secure.
    • Click More Information. A dialog box will appear.
    • Choose View Certificate.
    • Download PEM (chain).
  3. Import Certificates into Sterling B2B Integrator
    • Open the Dashboard UI in IBM Sterling B2B Integrator.
    • Go to Trading Partner → Digital Certificates → CA.
    • Upload each certificate from the downloaded PEM chain.
  4. Use Certificates in Adapter Configuration
    • Use the imported CA certificates in the SharePoint Client Adapter Configuration to enable secure communication.

Configuring the SharepointClientadapter

To configure the SharepointClientadapter:
  1. Select Deployment > Services > Configuration.
  2. Search for Sharepoint Client Adapter or select it from the list.
  3. Click Edit.
  4. Specify the field settings:
    Field Description
    Name Unique and meaningful name for the adapter configuration. Required.
    Description Description of adapter. Required.
    Environment
    Select one of the following options:
    • All Adapter Container Nodes
    • All ASI Nodes
    • All ASI nodes plus all Adapter Container Nodes
    • Node1
    Select a Group
    Select one of the following options:
    • None – You do not want to include this configuration in a group at this time.
    • Create New Group – You can enter a name for a new group in this field, which will then be created along with this configuration.
    • Select Group – If you have already created one or more groups for this adapter type, they are displayed in the list. Select group from the list.
    Sharepoint URL Required. Sharepoint URL is the domain of the SharePoint site or resource.
    For Sterling B2B Integrator v6.2.0.5_1 and later, the Sharepoint Client Adapter supports specifying SharePoint sites hosted under managed paths for both /sites or /teams. For example:
    https://yourdomain.sharepoint.com/sites/sitename
    or
    https://yourdomain.sharepoint.com/teams/teamname
    Tenant ID Unique identification of the Sharepoint instance, TenantID on Sharepoint. Required.
    Application ID Application ID of the application as registered in the application registration portal. Optional if it is present in Begin Session or Individual Services.
    System Certificate Specifies a valid system certificate ID from Digital certificates. This certificate is attached with application (in application registration) registered with Azure and will be used for client authentication.
    Site Name The name of the Sharepoint site. This parameter is required in Sterling B2B Integrator 6.2.0.5 and all prior versions.
    For Sterling B2B Integrator 6.2.0.5_1 and later, it is optional. If the Site Name is not provided as a parameter, it must be included in the SharePoint URL. For example:
    https://<sharepointURL>/<managedpath>/<sitename>
    Document Library Document Library. Optional. It can be set in individual services.
    Note: The precedence order of documentlibrary is Individual Services > Begin Session > Adapter Configuration. If documentlibrary is not set in any of the mentioned fields, then the default documentlibrary for site (Shared Documents) is used.
    Minimum Number of Threads A tuning parameter that indicates the range of threads available for handling events to improve performance. For more information, see Performance Tuning. Must be less than or equal to the maximum number of threads value. Required. The default value is 3.
    Maximum Number of Threads A tuning parameter that indicates the range of threads available for handling events to improve performance. For more information, see Performance Tuning. Must be greater than or equal to the minimum number of threads value. Required. The default value is 5.
    Timeout Amount of time in milliseconds after which the connection terminates in case of a connection error and the number of connection retries are attempted. Optional. The default value is 120000 milliseconds.
    Read Timeout Time out value in milliseconds. Optional. The default value is 120000 milliseconds.
    Proxy Server

    Whether to use a proxy server. Valid values are:

    • Yes – Proxy server is used
    • No – No proxy server is used
    Required.
    Note: Proxy can be used only on ASI and it is not supported on adapter containers due to the limitation from adapter container environment.
    Proxy hostname A valid proxy server hostname or IP address to use as a gateway. Required if proxy server is set to Yes.
    Proxy port Listen port number of the proxy server. Required if proxy server is set to Yes.
    CA Certificate Multi-picker for all the relevant CA Certificates on the Dashboard.
Note: For all services, there are following requirements for the filepattern parameter:
  • The filepattern must contain a valid regular expression supported by Java 8.
  • The following are the example values of filepattern:
    Assignment Result
    <assign to="filepattern">.+</assign> All documents
    <assign to="filepattern">.*log.*</assign> All documents which contain "log"
    <assign to="filepattern">fvt.+</assign> All documents whose name starts with "fvt"
    <assign to="filepattern">.*.xml</assign> All documents whose extension is ".xml"

Support for Managed Paths in Sharepoint Client Adapter

Starting with Sterling B2B Integrator 6.2.0.5_1, the Sharepoint Client Adapter supports specifying SharePoint sites hosted under managed paths for both /teams and /sites. You can include the managed path in the SharePoint URL parameter after the domain. For example:
https://yourdomain.sharepoint.com/sites or https://yourdomain.sharepoint.com/teams
The Site Name parameter can be used to specify either the site name or the team name. Alternatively, you can include the site or team name directly in the SharePoint URL parameter. For example:
https://yourdomain.sharepoint.com/sites/sitename
or
https://yourdomain.sharepoint.com/teams/teamname

Configuring the sharepointclient.properties file

The sharepointclient.properties file in the properties directory provides settings for the SharepointClientadapter. These properties can also be set through customer_override. The key for the file is sharepointclient.

To configure the sharepointclient.properties file, perform the following steps:
  1. Locate the sharepointclient.properties file in the properties directory where you installed Sterling B2B Integrator.
  2. Edit the sharepointclient.properties file.
  3. Configure the properties.
Refer to the following table for the properties:
DelayWaitingOnIO Specifies the number of seconds to wait for the data transfer to complete before going into the WAITING_ON_IO state. The default value is 10.
copyBufferSize Buffer size in GET and PUT services. The default value is 32768.
singleRequestFileSize The default value for file size to be used for single request. Use this to set a global default for PUT services (default 10MB). Sharepoint can read file upto (250 MB) in single request. This is the size of the file read in memory at a time. The default value is 10485760.
disablePersistForDocTracking Property that disables all persist calls in the Sharepoint client GET service. If this is true, the doc tracking information will not persist.
Following are Valid values:
  • True: Doc information will not be persisted.
  • False: Doc information will be persisted.
The default value is false.
idleTimeout Idle timeout in seconds for connections in a connection pool. The default value is 20.
useFixedPool Use fixed thread pool for authentication. If set to false, ForkJoinPool will be used. The default value is true.
authPoolSize Fixed thread pool size for authentication. The default value is 20.
maxTotalConnections The maximum number of http connections in a pool for all REST requests. The default value is 3.
useLocalTokenCache Uses local cache for access tokens. If set to false, every time authentication request will be sent to Sharepoint. The default value is true.
Note: In case of few or large files for PUT and GET services, make sure to increase the DelayWaitingOnIO property.

Business Process Example of All Sharepoint Client Services

To help you get started using the SharepointClientadapter, Sterling B2B Integrator includes a demo that provides an example of all the services. The demo transfers a file from the SharepointClientadapter to a specified document library in the Sharepoint site. The following graphic shows the business process model of SharepointClientDemoAllServices.

The BPML code associated with SharepointClientDemoAllServices is shown below:

To implement the SharepointClientDemoAllServices, replace the dummy values with the actual values in the following BP:
Note: The parameters can be selected according to the use case, not all the parameters are mandatory. The detailed description of parameters is mentioned in the Parameter Description section of the individual Sharepoint services.
Following are the instructions for running SharepointClientDemoAllServices services:
  1. Go to Business Process > Manager.
  2. Search for SharepointClientDemoAllServices.
  3. Click Execution Manager > Execute.
  4. Click Go.
<process name="SharepointClientDemoAllServices">
  <sequence>

    <operation name="Sharepoint Client Begin Session Service">
      <participant name="SharepointClientBeginSession"/>
      <output message="SharepointClientBeginSessionTypeInputMessage">
        <assign to="sharepointclientadapter">SharepointClientAdapter</assign>
        <assign to="systemcertid">systemcertid</assign> 
        <assign to="certificateid">certificateid</assign> 
        <assign to="applicationid">applicationidValue</assign> 
        <assign to="documentlibrary">documentlibraryValue</assign> 
        <assign to="connectiontimeout">30</assign>
        <assign to="readtimeout">30</assign>   
        <assign to="." from="*"></assign>
      </output>
      <input message="inmsg">
        <assign to="." from="*"></assign>
      </input>
    </operation>  

	<operation name="Sharepoint Client MKDOCLIB Service">
         <participant name="SharepointClientMkdoclib"/>
         <output message="SharepointClientMkdocibServiceTypeInputMessage">
          <assign to="documentlibrary">documentlibrary</assign>
          <assign to="." from="*"></assign>
         </output>
         <input message="inmsg">
           <assign to="." from="*"></assign>
         </input>
     </operation>
	 
	 <operation name="Sharepoint Client MKDIR Service">
         <participant name="SharepointClientMkdir"/>
         <output message="SharepointClientMkdirServiceTypeInputMessage">
          <assign to="documentlibrary">documentlibrary</assign>
          <assign to="foldername">foldername</assign> 
          <assign to="." from="*"></assign>
         </output>
         <input message="inmsg">
           <assign to="." from="*"></assign>
         </input>
     </operation>
	 
	 <operation name="Sharepoint Client PUT Service">
         <participant name="SharepointClientPut"/>
         <output message="SharepointClientPutServiceTypeInputMessage">
          <assign to="documentlibrary">documentlibrary</assign>
          <assign to="documentlist">documentlist</assign> 
          <assign to="documentid">documentid</assign> 
          <assign to="foldername">sourcefolder</assign> 
          <assign to="remotefilename">renmaedocument</assign> 
          <assign to="sourcefilelist">listof files</assign> 
          <assign to="filepattern">pattern</assign>   
          <assign to="." from="*"></assign>
         </output>
         <input message="inmsg">
           <assign to="." from="*"></assign>
         </input>
     </operation>
	 
	 <operation name="Sharepoint Client Get Service">
	  <participant name="SharepointClientGet"/>
	  <output message="SharepointClientGetServiceTypeInputMessage">
	    <assign to="." from="*"></assign>
		<assign to="foldername">testDir</assign>		
		<assign to="filepattern">test\d.txt</assign>             
		<assign to="remotefilename">backend1.pdf</assign>         
		<assign to="remotefilelist">backend1.pdf,abc.pdf</assign>  
        	<assign to="documentlibrary">documentlibrary</assign>
	  </output>
	  <input message="inmsg">
		<assign to="." from="*"></assign>
	  </input>
	</operation>
	 
    <operation name="Sharepoint Client List Service">
      <participant name="SharepointClientList"/>
      <output message="SharepointClientListServiceTypeInputMessage">
        <assign to="." from="*"></assign>
        <assign to="documentlibrary">documentlibrary</assign>
        <assign to="foldername">testDir</assign>
        <assign to="filepattern">test\.txt</assign>
        <assign to="maxItems"></assign>
     </output>
    <input message="inmsg">
        <assign to="." from="*"></assign>
    </input>
    </operation>
         
     <operation name="Sharepoint Client DELETE Service">
         <participant name="SharepointClientDelete"/>
         <output message="SharepointClientDeleteServiceTypeInputMessage">
          <assign to="documentlibrary">documentlibrary</assign> 
          <assign to="foldername">foldername</assign> 
		  <assign to="remotefilename">filename</assign> 
          <assign to="." from="*"></assign>
         </output>
         <input message="inmsg">
           <assign to="." from="*"></assign>
         </input>
     </operation>

    <operation name="Sharepoint Client End Session Service">
      <participant name="SharepointClientEndSession"/>
      <output message="SharepointClientEndSessionServiceTypeInputMessage">
          <assign to="." from="*"></assign>
      </output>
      <input message="inmsg">
          <assign to="." from="*"></assign>
      </input>
    </operation>
	
  </sequence>
</process>    

<!-- To catch all onFault handling to log an error to SharepointClientAdapter -->
<onFault>
<sequence name="End Session">
<operation name="Sharepoint Client End Session Service">
	<participant name="SharepointClientEndSession"/>
    <output message="SharepointClientEndSessionServiceTypeInputMessage">
	  <assign to="session_token" 
            from="SharepointClientBeginSession/session_token/text()">
	  </assign>
	  <assign to="." from="*"></assign>
    </output>
    <input message="inmsg">
	  <assign to="SharepointClientEndSessionServiceOnFaultResults" from="*"></assign>
    </input>
</operation>
</sequence>
</onFault>