Contact Free trial Login

Microsoft SharePoint 2010 Connector - Mule 3

Support Category: Select

Microsoft SharePoint 2010 Connector v1.0

Anypoint Connector for Microsoft SharePoint 2010 (SharePoint 2010 Connector) is a web app platform for content and document management, intranet portals, collaboration, extranets, websites, and enterprise search. The connector enables integration with SharePoint 2010 through its SOAP API.

Supported Operations

  • Lists and List Items API: Create, delete, retrieve, and update lists and list items

  • Files and Folders API: Create, delete, retrieve folders. Add, retrieve content, retrieve metadata, delete, check out, undo check out, check in, publish, unpublish, approve, deny, and copy files

POM File Information

If you Mavenize your Studio project, you can use this information in your project’s pom.xml file:

<dependency>
  <groupId>org.mule.modules</groupId>
  <artifactId>mule-module-sharepoint-2010</artifactId>
  <version>RELEASE</version>
  <classifier>mule-plugin</classifier>
</dependency>

Mule converts RELEASE to the latest version. To specify a version, view Microsoft SharePoint 2010 Connector in Anypoint Exchange and click Dependency Snippets.

Install the Connector

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

  2. Click Login in Anypoint Exchange.

  3. Search for the connector and click Install.

  4. Follow the prompts to install the connector.

Example Use Case

Step 1: Create a New Mule Project

Once Anypoint Studio has launched, create a new project:

  1. From the menu, select File > New > Mule Project.

  2. In the New Mule Project window, enter sharepoint2010-demo as the Project Name.

  3. Click Finish.

Step 2: Create and Configure a New SharePoint Global Element

Configure the connector to connect to a SharePoint 2010 instance:

  1. Click the Global Elements tab.

  2. Click Create to bring up Global Type dialog box.

  3. In the Filter text box, enter sha.

  4. Select Microsoft SharePoint 2010 and click OK.

  5. Fill in the required parameters. Refer to Connection Configuration for details.

  6. Click Test Connection to make sure the connection works correctly.

  7. Once the connection is successful, click OK.

Step 3: Create a Flow to Query SharePoint 2010

Create a Mule flow to query the "Shared Documents" List.

sharepointcanvas

To create the Mule flow, follow these steps:

  1. Click the Message Flow tab.

  2. Search for http and drag an HTTP connector onto the canvas. This creates a new flow.

  3. Search for sharepoint and drag Microsoft SharePoint 2010 next to the HTTP connector, on the Process area.

  4. Search for json and drag an Object to JSON transformer next to the Microsoft SharePoint 2010.

  5. Double-click the HTTP connector. Click the + beside the Connector Configuration list.

  6. In the HTTP Listener Configuration window, set Protocol to HTTP, Host to All Interfaces [0.0.0.0] (Default) and Port to 8081. Click OK.

  7. Under Basic Settings, set the Path to /query.

  8. Double-click the Microsoft Dynamics SharePoint 2010 and update the following configuration values:

    1. From the Connector Configuration list, select the Microsoft SharePoint 2010 configuration that was previously created.

    2. From the Operation list, select List Item query.

    3. From the Language list, click DataSense Query Language.

    4. Click Query Builder…

    5. From the list of Types, select Shared Documents.

    6. From the list of Fields, select ID and Title.

    7. From Order By list, select Title.

    8. From Direction list, select DESCENDING.

      sharepointquerybuilder
  9. Click OK.

Step 4: Running the Flow

  1. In Package Explorer, right-click sharepoint2010-demo and select Run As > Mule Application.

  2. Check the console to see when the application starts. You should see the DEPLOYED message if no errors occurred.

  3. Open a browser and visit http://localhost:8081/query

  4. The list of documents ordered by descending file name should be returned in JSON format (results vary depending on your SharePoint instance).

    [{"_ModerationStatus":"0","Editor":{"id":"8","lookUpListName":"User Information List"},"MetaInfo":"vti_parserversion:SR|14.0.0.7015\r\nvti_modifiedby:SR|i:0#.w|mule\\\\muletest\r\nListOneRef:IW|1\r\nvti_folderitemcount:IR|0\r\nvti_foldersubfolderitemcount:IR|0\r\nContentTypeId:SW|0x01010003DD4D13EF6C8446AB329E6FC42FE7BE\r\nvti_title:SW|\r\nvti_author:SR|i:0#.w|mule\\\\muletest\r\n","owshiddenversion":"2","lookUpListName":"Shared Documents","FileLeafRef":"error.txt","UniqueId":"{F0F6C9B9-6942-4866-B254-063EE8B70D59}","_Level":"1","PermMask":"0x7fffffffffffffff","ProgId":"","Last_x0020_Modified":"2015-04-09 16:21:35","Modified":"2015-04-09 16:21:20","DocIcon":"txt","ID":"1","FSObjType":"0","Created_x0020_Date":"2015-04-09 14:57:18","FileRef":"Shared Documents/error.txt"}]

Authentication Schemes

The Microsoft SharePoint 2010 connector supports the following authentication schemes:

  • NTLM Authentication

  • Kerberos Authentication

  • Claims-based Authentication

NTLM Authentication

sharepointntlmconfig

The NTLM Authentication scheme has the following parameters:

Parameter Description

Username

User to authenticate with.

Password

Password for the user to authenticate with.

Domain

Domain of the SharePoint instance.

Site URL

The path to the Microsoft SharePoint Site (https://sharepoint.myorganization.com/site).

Disable Cn Check

When dealing with HTTPS certificates, if the certificate is not signed by a trusted partner, the server might respond with an exception. To prevent this it is possible to disable the CN (Common Name) check. Note: This is not recommended for production environments.

Kerberos Authentication

sharepointkerberosconfig

The Kerberos Authentication scheme has the following parameters:

Parameter Description

Username

User to authenticate with.

Password

Password for the user to authenticate with.

Domain

Domain of the SharePoint instance.

Site URL

The path to the Microsoft SharePoint Site (https://sharepoint.myorganization.com/site).

Disable Cn Check

When dealing with HTTPS certificates, if the certificate is not signed by a trusted partner, the server might respond with an Exception. To prevent this it is possible to disable the CN (Common Name) check. Note: This is not recommended for production environments.

Service Principal Name (SPN)

The SPN looks like host/SERVER-NAME.MYREALM.COM

Realm

The Domain that the user belongs to. Note that this value is case-sensitive and must be specified exactly as defined in Active Directory.

KDC

This is usually the Domain Controller (server name or IP).

Advanced Kerberos Configuration

If the environment is complex and requires further settings, a Kerberos configuration file has to be created manually and referenced in the connector’s connection configuration.

The following parameters are available for advanced scenarios:

  • Login Properties File Path: Path to a customized Login Properties File. You can tune the Kerberos login module (Krb5LoginModule) with scenario-specific configurations by defining a JAAS login configuration file. When not specified, default values which usually work for most cases are set up. There are two options for setting this property:

    • Place the file in the class path (usually under src/main/resources) and set the value of the property to classpath:jaas.conf.

    • Provide the full path to the file as in C:\kerberos\jaas.conf.

  • Kerberos Properties File path: Path to a customized Kerberos Properties File. There are two options for setting this property:

    • Place the file in the class path (usually under src/main/resources) and set the value of the property to classpath:krb5.conf.

    • Provide the full path to the file as in C:\kerberos\krb5.conf.

JAAS Login Configuration File

Following is a sample of the JAAS login configuration file for the Kerberos login module:

Kerberos {
    com.sun.security.auth.module.Krb5LoginModule required
    debug=true
    refreshKrb5Config=true;
};

For more information on how to create the JAAS login configuration file for the Kerberos login module, see Krb5LoginModule.

Kerberos Configuration File

Following is a sample of the content of a Kerberos configuration file:

[libdefaults]default_realm = MYREALM.COM[realms]MYREALM.COM = { kdc = mydomaincontroller.myrealm.com default_domain = MYREALM.COM}[domain_realm].myrealm.com = MYREALM.COMmyrealm.com = MYREALM.COM

Important: Realm and default_domain are case-sensitive and must be specified exactly as defined in Active Directory. Receiving an error during Test Connection stating "Message stream modified (41)" is an indication that the domain name is not correctly formed.

More information on how to create the Kerberos configuration file can be found at krb5_conf.

Claims-Based Authentication

sharepointclaimsconfig

The Claims-Based authentication scheme has the following parameters:

Parameter Description

Username

User to authenticate with.

Password

Password for the user to authenticate with.

Domain

Domain of the SharePoint instance.

Site URL

The path to the Microsoft SharePoint site (https://sharepoint.myorganization.com/site).

Security Token Service URL (STS URL)

The STS endpoint that accepts username and password for authenticating users and understands the WS-Trust 1.3 protocol. When the STS is Microsoft’s ADFS (Active Directory Federation Services), this URL usually is: https://youradfs.com/adfs/services/trust/13/usernamemixed

Security Token Service (STS) App Identifier (Scope)

This string that identifies the SharePoint site in the STS. It is also known as Relying Party Identifier, Client Identifier, Scope or Realm. When the STS is Microsoft’s ADFS, this value can be discovered in the AD FS Management console under AD FS > Trust Relationships > Relying Party Trusts > (SharepoinP Site’s relying part properties) > Identifiers tab.

Disable Cn Check

When dealing with HTTPS certificates, if the certificate is not signed by a trusted partner, the server might respond with an Exception. To prevent this it is possible to disable the CN (Common Name) check. Note: this is not recommended for production environments.

Note: The Sts App Identifier can be obtained by logging into the SharePoint site that want to be accessed by opening the Site URL in a web browser. If there is more than one authentication provider configured for the site, a drop-down lists the options. Selecting the desired STS redirects to the STS’s login page. At this point, the address bar of the web browser contains a URL that includes the following query parameters wa=wsignin1.0&wtrealm=uri%3amule%3asp80. The parameter wa tells the STS that a sign in is being initiated. The wtrealm contains the URL-encoded value STS App Identifier. In the example, uri%3amule%3asp80 is uri:mule:sp80. The unencoded value is the parameter for the connector’s configuration.

Security Token Authentication

You can use a SAML security token to log in to SharePoint. You can provide an XML body via a POST request to get the security token that you put in the Studio Security Token field.

To obtain a security token, make a POST request to https://login.microsoftonline.com/extSTS.srf with this 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 to this request contains the security token between the <wsse:BinarySecurityToken> tags.

After you have a security token, specify the token value in Studio:

sharepoint security token config
  • Security token: Enter the security token you obtained.

  • Site URL: Enter your SharePoint site URL.

Lists and List Items API Operations

  • List Create

    Creates a list in the current site based on the specified name, description, and list template ID.

  • List Get

    Returns a schema for the specified list.

  • List Get All

    Retrieves all SharePoint lists.

  • List Delete

    Deletes the specified list.

  • List Update

    Updates a list based on the specified list properties.

  • List Item Create

    Creates a new item in an existing SharePoint list.

    sharepointobjectbuilder
  • List Item Delete

    Deletes an Item from a SharePoint list.

  • List Item Update

    Updates an Item from a SharePoint list.

    sharepointobjectbuilder
  • List Item Query

    Executes a query against a SharePoint list and returns list items that matches the specified criteria.

    Additionally to the selected fields, the following fields are always returned:

    • Created: Creation date of the item

    • FileRef: Relative URL of the file, if it is a Documents or Picture Library

    • FSObjType

    • _Level

    • MetaInfo

    • _ModerationStatus

      Moderation Status of the file if it belongs to a Library that has moderation enabled:

    • Modified: Modification date of the item

    • PermMask

    • showshiddenversion

    • UniqueId

  • Folder Create

    Creates a folder in a Document or Picture library.

  • Folder Delete

    Deletes a folder from a Document or Picture library.

  • Folder Query

    Retrieves all folders that matches the specified criteria.

    Additionally to the selected fields, the following fields are always returned:

    • Created: Creation date of the item

    • Created_x0020_Date

    • Editor: A user

    • FileLeafRef: Name of the folder

    • FileRef: Relative URL of the folder

    • FSObjType

    • Last_x0020_Modified*

    • _Level

    • MetaInfo

    • _ModerationStatus

      Moderation Status of the file if it belongs to a Library that has moderation enabled:

    • Modified: Modification date of the item

    • PermMask

    • ProgId

    • showshiddenversion

    • UniqueId

  • File Add

    Adds a file to a Document or Picture library.

  • File Get Content

    Retrieves the content of a file.

  • File Get Metadata

    Retrieves the metadata of a file.

  • File Delete

    Deletes a file from a Document or Picture library.

  • File Check Out

    Checks out a file from a document library.

  • File Undo Check Out

    Reverts an existing checkout for a file.

  • File Check In

    Checks in a file to a document library.

  • File Publish

    Submits the file for content approval.

  • File Unpublish

    Removes a file from content approval or unpublish a major version.

  • File Approve

    Approves a file submitted for content approval.

  • File Deny

    Denies approval for a file that was submitted for content approval.

  • File Copy To

    Copies the file to the destination URL.

  • File Query

    Retrieves all files from a folder that matches the specified criteria.

    Additionally to the selected fields, the following fields are always returned:

    • Created: Creation date of the item

    • Created_x0020_Date

    • DocIcon

    • Editor: A user

    • FileLeafRef: Name of the folder

    • FileRef: Relative URL of the folder

    • FSObjType

    • Last_x0020_Modified

    • _Level

    • MetaInfo

    • _ModerationStatus

      Moderation Status of the file if it belongs to a library that has Moderation enabled:

    • Modified

      Modification date of the item

    • PermMask

    • ProgId

    • showshiddenversion

    • UniqueId

Reference Objects

If you choose for a query to return either SharepointListReference or SharepointListMultiValueReference, the returned value of the field depends on the value of the Retrieve full objects for reference fields parameter:

  • Not checked: A summary object containing the reference object’s ID and the reference object list’s ID:

    {
        "Title": "A title",
        "LookupField":
            {
                "id": "1",
                "lookupListName": "aaaa-1111-bbbb-2222"
            },
        "MultiValueLookupField":
            {
                "ids":
                    [
                        "1",
                        "2",
                        "3"
                    ],
                "lookupListName": "cccc-3333-dddd-4444"
            }
    }

    Resolve method:

    Both summary objects, SharepointListReference or SharepointListMultiValueReference, make available a method called resolve.

    After calling this method, the method returns the fully referenced object and replaces the summary object in the item with this resolved reference.

    For example, calling the resolve method on the LookupField returns the item with ID "1" of the list with title "aaaa-1111-bbbb-2222" and the item contains:

    {
        "Title": "A title",
        "LookupField":
            {
                "ID": "1",
                "lookupListName": "aaaa-1111-bbbb-2222"
                "Title": "Another title",
                "Property": "A property",
                ...
            },
        "MultiValueLookupField":
            {
                "ids":
                    [
                        "1",
                        "2",
                        "3"
                    ],
                "lookupListName": "cccc-3333-dddd-4444"
            }
    }
  • Checked: The full object that the graph retrieves.

    In case there is a cycle, the summary reference object is shown:

    "Title": "A title",
        "LookupFieldId":
            {
                "Title": "Another title",
                "Id": "1",
                Property1": "A value",
                ...
            },
        "MultiValueLookupFieldId":
            [
                {
                    "Title": "Another title",
                    "Id": "1",
                    "Property1": "A value",
                    ...
                },
                {
                    "Title": "Another title",
                    "Id": "2",
                    "Property1": "A value",
                    ...
                }
            ]
    }

    Note: Checking this option might cause large items with many reference fields to take a long time to retrieve.