HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In
GitHubNuGetDev CommunityDoc feedback

The connector copies documents, blocks, or other items from SharePoint document libraries and lists these automatically.

Updates can be scheduled or managed manually, and are available in CMS as media or blocks. Additionally, developers can manipulate documents or blocks as they are being transferred, to customize applications to specific requirements in CMS.

## Requirements

  • [Contact customer support](🔗) to request a license

  • A SharePoint license

  • SharePoint versions 2013, 2016, 2019, or SharePoint Online

  • An Optimizely Content Management System (CMS) installation

  • See [Add-ons platform compatibility](🔗) for package and version information

  • See User guide: [Optimizely Connect for Sharepoint](🔗)

## Install

  • Versions 7.5 and higher are [installed through NuGet](🔗)

  • Lower versions are available as zip files for [download](🔗)

### About the installation

The Optimizely SharePoint connector is [installed as a NuGet package](🔗)

When you install the SharePoint NuGet package, a third-party dependency adds the following entry in **web.config,** but because the entry is already in **web.config**, it causes a duplicate name error. You can fix the duplicate name error by changing the name of **ExtensionlessUrlHandler-Integrated-4.0** to something else.

### About ISharepointProcessor

The **ISharePointProcessor** interface lets you implement a class to override or enhance the way that Optimizely processes SharePoint objects. For example, you want to add a prefix to filenames as you copy the SharePoint files to the Optimizely CMS, or filter specific file types from being copied to the Optimizely CMS, or you want to notify a user after the files are copied.

### ISharePointProcessor interface

The **ISharePointProcessor** interface has the following methods:

  • **AddDocument** – Adds a document to the data store.

  • **AddFolder** – Adds a folder to the data store.

  • **DeleteDocument** – Deletes a document from the data store.

  • **DeleteFolder** – Deletes a folder from the data store.

  • **UpdateDocument** – Updates (overwrites) a document in the data store.

  • **UpdateFolder** – Updates (overwrites) a folder in the data store.

### Install the SharePointProcessor example

The **SharePointProcessor** example code consists of two classes:

  • [**InitializeModule.cs**](🔗). Implements the `PackageInitializer` class, which registers the _demo processing module_.

  • [**DemoProcessor.cs**](🔗). `DemoProcessor` is for demonstration purposes only. The sample `DemoProcessor` implementation calls the default behavior of the existing SharePoint processor and describes how to override the default behavior to extend or enhance it.  You can create your own class that inherits `ISharePointProcessor` so that when you initialize it, it overrides the default SharePoint processor.  


You can have only one overriding processing service.

To install the SharePointProcessor example code:

  1. Create a project in Visual Studio.

  2. Copy the DLL that contains your processor implementation into the bin folder of your solution.

  3. Restart the web server.

### Register your processor

Register your SharePoint processor using the service locator in Optimizely, as shown in the following example:

### Demo Processor

The demo processor class implements the `ISharePointProcessor` interface. The default implementation of each method is to call the default processor. For example:


The demo processor reads only the metadata for a specific document in SharePoint and sends the metadata to the plugin processor methods. The demo processor and the `AddDocument` method show how to retrieve the data use the default SharePoint processor by calling the default processor’s `getFileStream(item)` method, as shown in the following code samples.

### InitializeModule.cs

### DemoProcessor.cs

As an example, you can add a prefix to filenames that you bring into media from SharePoint.

  1. Add `item.File.Name = "EPi" + item.FIle.Name;` in the AddDocument section, just after the code `var data = defaultProcessor.getFileStream(item);`.

  2. Build `DemoProcessor.cs`.

  3. Run the SharePoint connector to upload the _Sample.txt_ sample file. The custom `DemoProcessor` changes the name of the file and passes the name to the default processor, which copies _Sample.txt_ to _EPiSample.txt_ in the media store.

## Register the Connect for SharePoint app

  1. Log on to the Azure portal (<https://portal.azure.com/>) using your global admin user account.

  2. Go to **Azure Active Directory**.

  3. In the navigation pane, click **App registrations**. The App registrations page appears. [block:image] { "images": [ { "image": [ "https://files.readme.io/b1ce439-app-registrations.png", "app-registrations.png", 809 ], "align": "center", "border": true } ] } [/block]

  4. Click **New registration**. The Register an application screen appears.

  5. In the **Name **box, enter a name for the app.

  6. Under Supported account types, select **Accounts** in this organizational directory only (tenant_prefix - Single tenant).

  7. Click **Register**. [block:image] { "images": [ { "image": [ "https://files.readme.io/e260d57-Register-an-application.png", "Register-an-application.png", 715 ], "align": "left", "border": true } ] } [/block]


    Copy and paste the following values in a document that you can access later. You will enter these values in the Optimizely software when you complete the Office 365 guided setup.

    **Application ID** **Directory ID**

  8. In the navigation pane, click **API permissions**.

  9. Click **Add a permission**.

  10. Click Microsoft Graph and complete the following steps:

    a. Click **Application permissions**.

    b. Select the User.Read permission.

  11. Click **Add permissions**. [block:image] { "images": [ { "image": [ "https://files.readme.io/db235ea-add-permissions.png", "add-permissions.png", 647 ], "align": "left", "border": true } ] } [/block]

  12. Click **Grant admin consent for tenant_name**.

  13. Click **Yes**.

  14. In the navigation pane, click **Certificates & secrets.** The Certificates & secrets page appears.

  15. Click **New client secret**. The Add a client secret dialog box appears.

  16. Enter a description, and then optionally select **Never expire**.

  17. Click **Add**.

  18. Copy and paste the client secret value in a document that you can access later. You will enter this value when you complete the Office 365 guided setup.

  19. To assign full permissions to the tenant to back up SharePoint sites, in your browser, go to the tenant URL. For example, go to _https\://\<office_365_tenant_URL>/\_layouts/15/appinv.aspx_. The SharePoint admin center page appears.

  20. In the App ID box, enter the application ID that you recorded earlier, and then click Lookup. In the Title box, the name of the application appears.

  21. In the App Domain box, type tenantname.onmicrosoft.com. To get the correct domain name, go to the Microsoft Azure website, Custom domain names.

  22. In the App's Permission Request XML box, type the following XML string:



  1. Click **Create**.

  2. Click **Trust It**.