Contact Us 1-800-596-4880

Microsoft SharePoint Connector 3.3 - Mule 4

Anypoint Connector for Microsoft SharePoint (Microsoft SharePoint Connector) supports both SharePoint 2013 and SharePoint Online for use in the cloud and on-premises. This connector enables you to manage content and document management, to access intranet and extranet portals and websites, to collaborate with, and to search your entire enterprise. This connector also enables integration with SharePoint through its REST API.

For compatibility information and fixed issues, see the Microsoft SharePoint Connector Release Notes.

Before You Begin

To use this connector, you must be familiar with:

  • The Microsoft SharePoint API

  • Anypoint Connectors

  • Mule runtime engine (Mule)

  • Elements and global elements in a Mule flow

  • Creating a Mule app using Anypoint Studio (Studio)

Before creating an app, you must have:

  • Credentials to access the Microsoft SharePoint target resource

  • Anypoint Platform

  • Anypoint Studio version 7.x or later

POM File Information

<dependency>
  <groupId>com.mulesoft.connectors</groupId>
  <artifactId>mule-sharepoint-connector</artifactId>
  <version>x.y.z</version>
  <classifier>mule-plugin</classifier>
</dependency>

Replace x.y.z with the version that corresponds to the connector you are using.

To obtain the most up-to-date pom.xml file information, access the connector in Anypoint Exchange and click Dependency Snippets.

Okta Authentication

Okta Authentication Configuration

Configuring the connector to use Okta authentication requires the following information:

  • Okta Domain: The Okta endpoint that accepts the Okta username and password for authentication, for example: your-domain.okta.com

  • Okta Username: Your Okta username, for example: your-email@example.com

  • Okta Password: Your Okta password.

  • Okta API Token: Okta uses a bearer token for API authentication with a sliding scale expiration, for example: http://developer.okta.com/docs/api/getting_started/getting_a_token.html

  • SharePoint Online Embedded Link: The link of your Microsoft Office 365 SharePoint Online application from Okta, for example: https://your-domain.okta.com/home/office365/0oa14mz7f4HAWypdZ1t7/31737

Security Token Authentication

You can use a SAML security token to log in to SharePoint. The following shows how to configure a security token in Studio:

Security Token Configuration
  • Security token: Enter the corresponding security token.

  • Site URL: Enter the corresponding site URL.

You can obtain a security token by making a POST request to https://login.microsoftonline.com/extSTS.srf with the following XML body:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
      xmlns:a="http://www.w3.org/2005/08/addressing"
      xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <s:Header>
    <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</a:Action>
    <a:ReplyTo>
      <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
    </a:ReplyTo>
    <a:To s:mustUnderstand="1">https://login.microsoftonline.com/extSTS.srf</a:To>
    <o:Security s:mustUnderstand="1"
       xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <o:UsernameToken>
        <o:Username>[username]</o:Username>
        <o:Password>[password]</o:Password>
      </o:UsernameToken>
    </o:Security>
  </s:Header>
  <s:Body>
    <t:RequestSecurityToken xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">
      <wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
        <a:EndpointReference>
          <a:Address>[endpoint]</a:Address>
        </a:EndpointReference>
      </wsp:AppliesTo>
      <t:KeyType>http://schemas.xmlsoap.org/ws/2005/05/identity/NoProofKey</t:KeyType>
      <t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType>
      <t:TokenType>urn:oasis:names:tc:SAML:1.0:assertion</t:TokenType>
    </t:RequestSecurityToken>
  </s:Body>
</s:Envelope>

The response from the previous request contains the security token between the <wsse:BinarySecurityToken> tags.

About Connector Terminology

  • Actions - Operations that allow side effects, such as data modification, and cannot be further composed to avoid non-deterministic behavior.

  • Complex types - Keyless named structured types consisting of a set of properties. Complex types are commonly used as property values in model entities, or as parameters or return values for operations.

  • Entities - Instances of entity types, for example, an account or an opportunity.

  • Entity sets - Named collections of entities, for example, an account is an entity set containing account entities. An entity’s key uniquely identifies the entity within an entity set.

  • Entity types - Named structured types with a key. Entity types define the named properties and relationships of an entity, and may derive by single inheritance from other entity types.

  • Enumeration types or Enum types - Named primitive types whose values are named constants with underlying integer values.

  • Functions - Operations that do not have side effects and may support further composition, for example, with additional filter operations, functions, or an action.

Connect in Anypoint Studio 7

You can use this connector in Anypoint Studio by first downloading it from Exchange and configuring it as needed.

Add the Connector to Your Studio Project

Anypoint Studio provides two ways to add the connector to your Studio project: from the Exchange button in the Studio taskbar or from the Mule Palette.

Add the Connector Using Exchange

  1. In Studio, create a Mule project.

  2. Click the Exchange icon (X) in the upper-left of the Studio task bar.

  3. In Exchange, click Login and supply your Anypoint Platform username and password.

  4. In Exchange, search for "share".

  5. Select the connector and click Add to project.

  6. Follow the prompts to install the connector.

Add the Connector in Studio

  1. In Studio, create a Mule project.

  2. In the Mule Palette view, click (X) Search in Exchange.

  3. In Add Modules to Project, type "share" in the search field.

  4. Click the connector’s name in Available modules.

  5. Click Add.

  6. Click Finish.

Configure Your First Flow

To configure:

  1. In Anypoint Studio, click File > New > Mule Project.

  2. Specify a value for Project Name and click Finish.

  3. Click the Global Elements tab.

  4. Click Create.

  5. Search for "sharepoint".

  6. Click Microsoft SharePoint and click OK.

  7. Choose the Global Type to configure:

    Global Types
  8. Click Test Connection to ensure the connection works correctly:

    Global Element Properties

Create an Anypoint Studio Flow

To create an Anypoint Studio flow:

  1. In Anypoint Studio, click File > New > Mule Project.

  2. Specify a value for Project Name and click Finish.

  3. Search for http and drag an HTTP connector to the canvas.

  4. Search for sharepoint and drag a Microsoft SharePoint connector next to the HTTP connector.

    Studio Visual Editor Flow
  5. Double-click the HTTP connector and set Host to 0.0.0.0, Port to 8081, and Path to fileAdd.

  6. Click OK.

  7. Double-click the Microsoft SharePoint connector and click the green plus symbol.

  8. From the Connector Configuration list, click the Microsoft SharePoint configuration that was previously created.

  9. From the Operation list, click File Add.

    Set these fields:

    Studio Visual Editor Fields
    • File server relative URL: The path and file name in SharePoint of where to create the file.

    • File content stream: The content of the file to be created.

Run a Flow

  1. In Package Explorer, right click your project’s name, and click Run As > Mule Application.

  2. Check the console to see when the application starts. You should see messages such as these if no errors occur:

    ************************************************************
    INFO  2019-10-14 22:12:42,003 [main] org.mule.module.launcher.DeploymentDirectoryWatcher:
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    + Mule is up and kicking (every 5000ms)                    +
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    INFO  2019-10-14 22:12:42,006 [main] org.mule.module.launcher.StartupSummaryDeploymentListener:
    **********************************************************
    *  - - + DOMAIN + - -               * - - + STATUS + - - *
    **********************************************************
    * default                           * DEPLOYED           *
    **********************************************************
    
    ************************************************************************
    * - - + APPLICATION + - -   * - - + DOMAIN + - -  * - - + STATUS + - - *
    ************************************************************************
    * myapp                     * default             * DEPLOYED           *
    ************************************************************************

Frequently Asked Questions

  • Which versions of SharePoint are supported by this connector?

    The SharePoint connector supports SharePoint Online on-premises and SharePoint online versions.

  • What authentication schemes are supported by this connector?

    SharePoint Online supports authentication using standard SharePoint Online user credentials is supported, secure authentication, and Okta authentication.

  • What parts of the SharePoint object model are accessible by the connector?

    Specific support for Files and Folders, Lists, ListItems, and Attachments is offered. Additionally, all other entities of the SharePoint API are accessible in JSON form using the ResolveObject and ResolveCollection operations.

  • Are DataSense and DataWeave supported by this connector?

    Yes, all supported entities and entity attributes are exposed to Studio by the connector for use with DataWeave.

  • What operations can I perform with the connector?

    For the Lists and ListItems API, operations include create, retrieve, update, and delete.

    For Files and Folders, operations include add, retrieve content, retrieve metadata, delete, check out, undo check out, check in, publish, unpublish, approve, deny, recycle, and copy.

  • What Mule editions can I use this connector with?

    This connector is supported on any Enterprise Edition Anypoint platform running on any operating system and bit type, including the CloudHub integration PaaS.

  • How do I build a query for a query operation?

    The query operations Folder Query, File Query, and List Item Query only support OData queries.

    For the List Item Query operation, the query has this format: LIST_ID?$select=FIELDS_TO_SELECT&filter=FILTER_PART.

    For example: Vessels?$select=Title,FLAG,SEGMENT,ID,VesselName&$filter=Title eq 1.

    The same format applies to the other query operations.

    To learn more about building queries, see the SharePoint documentation page Use OData query operations in SharePoint REST requests.

  • How do I parse an HTML form so that I can test the demo?

    Use the <parse-template> statement, as shown in the Use Case XML section. In this use case, forminput.html is the file that Mule uses as a template into which to insert values extracted from the message properties or variables. For more information, see the Parse Template Reference.

Use Case XML

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
	xmlns:sharepoint="http://www.mulesoft.org/schema/mule/sharepoint"
	xmlns:http="http://www.mulesoft.org/schema/mule/http"
	xmlns="http://www.mulesoft.org/schema/mule/core"
	xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core
	http://www.mulesoft.org/schema/mule/core/current/mule.xsd
	http://www.mulesoft.org/schema/mule/http
	http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
	http://www.mulesoft.org/schema/mule/sharepoint
	http://www.mulesoft.org/schema/mule/sharepoint/current/mule-sharepoint.xsd
	http://www.mulesoft.org/schema/mule/ee/core
	http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
 <configuration-properties file="mule-app.properties"/>
	<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config">
		<http:listener-connection host="localhost" port="8081" />
	</http:listener-config>
	<sharepoint:sharepoint-online-config
		name="SharePoint_SharePoint_online"
		doc:name="SharePoint online">
		<sharepoint:online-connection
			username="${sharepoint.username}"
			password="${sharepoint.password}"
			siteUrl="${sharepoint.siteUrl}"
			disableCnCheck="${sharepoint.disableCnCheck}" />
	</sharepoint:sharepoint-online-config>
	<flow name="UI-PROVIDER">
		<http:listener
			doc:name="Listener"
			config-ref="HTTP_Listener_config"
			path="/demo"/>
		<parse-template doc:name="Parse Template" location="formInput.html"/>
	</flow>
	<flow name="FILE-ADD_FLOW">
		<http:listener doc:name="Listener" config-ref="HTTP_Listener_config"
		path="/fileadd"/>
		<sharepoint:file-add doc:name="File add"
		config-ref="SharePoint_SharePoint_online"
		fileServerRelativeUrl="#[attributes.queryParams.path]"
		overwrite="true">
		<sharepoint:file-content-stream ><![CDATA[#[attributes.queryParams.content]]]></sharepoint:file-content-stream>
		</sharepoint:file-add>
		<ee:transform doc:name="Transform Message">
			<ee:message >
				<ee:set-payload ><![CDATA[%dw 2.0
output application/java
---
payload.name
]]></ee:set-payload>
			</ee:message>
		</ee:transform>
		<set-payload value="#[payload ++ ' Successfully created.']"
		doc:name="Set Payload" mimeType="text/plain"/>
	</flow>

	<flow name="FILE-GET-CONTENT-FLOW"  >
		<http:listener doc:name="Listener" config-ref="HTTP_Listener_config"
		path="/filegetcontent"/>
		<sharepoint:file-get-content doc:name="File get content"
		 config-ref="SharePoint_SharePoint_online">
			<sharepoint:file-server-relative-url ><![CDATA[#[attributes.queryParams.path]]]></sharepoint:file-server-relative-url>
		</sharepoint:file-get-content>
		<set-payload value="#[payload]" doc:name="Set Payload"
		 mimeType="text/plain"/>
	</flow>

	<flow name="FILE-GET-META-FLOW">
		<http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="/getmetadata"/>
		<sharepoint:get-metadata doc:name="Get metadata"
		 config-ref="SharePoint_SharePoint_online">
			<sharepoint:file-server-relative-url ><![CDATA[#[attributes.queryParams.path]]]></sharepoint:file-server-relative-url>
		</sharepoint:get-metadata>
		<ee:transform doc:name="Transform Message">
			<ee:message >
				<ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
payload]]></ee:set-payload>
			</ee:message>
		</ee:transform>
	</flow>
	<flow name="FILE-DELETE-FLOW">
		<http:listener doc:name="Listener" config-ref="HTTP_Listener_config"
		path="/deletefile"/>
		<sharepoint:file-delete doc:name="File delete"
		 config-ref="SharePoint_SharePoint_online">
			<sharepoint:file-server-relative-url ><![CDATA[#[attributes.queryParams.path]]]></sharepoint:file-server-relative-url>
		</sharepoint:file-delete>
		<set-payload value="#[payload  ++ ' Successfully deleted.']"
		doc:name="Set Payload" mimeType="text/plain"/>
	</flow>
</mule>
View on GitHub