Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+
Nav

Microsoft SharePoint Connector

Select

The Microsoft SharePoint connector provides support for both SharePoint 2013 and SharePoint Online for use in the cloud and on-premises. This connector enables content and document management, access to intranet and extranet portals and websites, collaboration, and enterprise search. This connector also enables integration with SharePoint through its REST API.

Prerequisites

This document assumes that you are familiar with SharePoint, Mule, Anypoint Connectors, Anypoint Studio, Mule concepts, elements in a Mule flow, and Global Elements.

You need login credentials to test your connection to your target resource.

For hardware and software requirements and compatibility information, see the Connector Release Notes.

To use this connector with Maven, view the pom.xml dependency information in the Dependency Snippets in Anypoint Exchange.

What’s New in this Connector

In Mule 4 SharePoint Online and SharePoint OnPremise were merged into one connector that includes all functionalities from both previous connectors.

To Connect in Design Center

  1. Click a trigger. You can create a global element by selecting this connector as they trigger. If a global element is not needed, you can use an HTTP Listener or Scheduler trigger.

  2. To create an optional global element for the connector, set these fields:

    Global Element for the Connector

  3. Required Parameters Online Configuration.

  4. Okta Authentication.

  5. Select the plus sign to add a component.

  6. Select the connector as a component.

Required Parameters Online Configuration

Online Configuration

  • Username: Enter the SharePoint username.

  • Password: Enter the corresponding password.

  • Site URL: Enter the corresponding site URL.

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

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.

Install Connector in Studio

  1. In Anypoint Studio, click the Exchange icon in the Studio task bar.

  2. Click Login in Anypoint Exchange.

  3. Search for this connector and click Install.

  4. Follow the prompts to install this connector.

When Studio has an update, a message displays in the lower right corner, which you can click to install the update.

To Configure Your First Flow

To configure:

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

  2. Specify a 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 

To Create an Anypoint Studio Flow

To create an Anypoint Studio flow:

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

  2. Specify a 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. Click OK.

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

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

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

To 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:

    
                
             
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    ************************************************************
    INFO  2018-01-14 22:12:42,003 [main] org.mule.module.launcher.DeploymentDirectoryWatcher:
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    + Mule is up and kicking (every 5000ms)                    +
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    INFO  2018-01-14 22:12:42,006 [main] org.mule.module.launcher.StartupSummaryDeploymentListener:
    **********************************************************
    *  - - + DOMAIN + - -               * - - + STATUS + - - *
    **********************************************************
    * default                           * DEPLOYED           *
    **********************************************************
    
    ************************************************************************
    * - - + APPLICATION + - -   * - - + DOMAIN + - -  * - - + STATUS + - - *
    ************************************************************************
    * myapp                     * default             * DEPLOYED           *
    ************************************************************************

Example: SharePoint Connector

This example demonstrates the use of Microsoft SharePoint Connector.

To build and run this demo project, you need:

  • Anypoint Studio with at least the Mule 4.0 Runtime.

  • Microsoft SharePoint Connector v2.0.0 or higher.

To Test the Flow

  1. Import the demo project into your workspace using Anypoint Exchange or using the Import command in the File menu.

  2. Specify your credentials in the /src/main/app/mule-app.properties file:

  3. Run the project in Studio.

  4. Type localhost:8081/demo in your browser to access the selection menu of the demo.

  5. Optionally you can configure the Connection Timeout and Read Timeout. The Connection Timeout is the timeout in making the initial connection with the server. The Read Timeout is the timeout on waiting to read data from the server.

You can use the selection menu from http://localhost:8081 to test the flows or you can POST JSONs using a tool like curl, or any other tool (Chrome/Mozilla Firefox extensions) that lets you POST a body when calling the URL.

About 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?

    For SharePoint Online, authentication using standard SharePoint online user credentials is supported as well as 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.

Use Case XML


         
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?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 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>