Sharepoint

The SharePoint data source type allows end users to access and manipulate files and data stored in a Sharepoint Online instance. While similar to OneDrive, Sharepoint is intended for team collaboration and communication while working on a project. For more information on the differences between OneDrive and Sharepoint, see Microsoft documentation.

When configuring a connection to your Sharepoint instance, there are two different authentication mechanisms to choose from:

  • Using an OAuth 2.0 authentication provider

  • Using the SharePoint_SharedLogin custom authentication provider

    Note

    This method can only available to Skuid on Salesforce users.

Warning

Sharepoint connections are not supported when using Skuid on Salesforce in Lightning.

Connect Using OAuth 2.0 Authentication

To connect to SharePoint using OAuth2.0, you’ll need to complete three steps:

  • Create a SharePoint app
  • Create the SharePoint authentication provider
  • Create the SharePoint data source

Prerequisites

  • A SharePoint Online instance, accessible online via a URL such as https://<CompanyName>.sharepoint.com, (where <CompanyName> is your SharePoint Online company name).

  • The app domain for your Skuid site.

    • For Skuid Platform:
      • Use the base URL for your Skuid site: example.skuidsite.com.
    • For Skuid on Salesforce:
      1. Use the Salesforce App Menu to navigate to the Skuid app, and click it.
      2. In the Skuid app, copy the URL.
      3. Remove everything from /apex onwards.
  • The redirect URI for your Skuid site.

    When using Skuid on Salesforce, the callback URL will depend on several things:

    • Whether or not the Remove Instance Names from URLs critical update is activated
      • If the above critical update is not activated, then the Salesforce org’s instance
    • If set, the Salesforce org’s My Domain
    • Whether the org is a developer edition or sandbox org

    Each of these variables will change parts of the callback URL.

    There are also different URLs needed based on whether the Skuid page is deployed using the Redirect or skuid:page Visualforce component override method. Because of this, it’s best to enter two callback URLs for Skuid on Salesforce orgs.

    To ensure the accuracy of your callback URLs, fill out the form below to generate the appropriate Salesforce callback URLs for your org:

    Note

    Unsure what your instance and My Domain are? The URL of the Skuid Pages list within the Salesforce Classic layout is a quick way to find the information needed for callback URLs. For example:

    https://customMyDomain-dev-ed--skuid.na30.visual.force.com/apex/PageList

    From the above URL you can deduce the following:

    • customMyDomain is the My Domain
    • -dev-ed indicates this is likely a developer’s edition org
    • na30 is the instance.

    How these URLs are formed [[]]

    If the Remove Instance Names critical update is activated, and the org’s My Domain is configured, the callback URLs should be:

    • https://<myDomain>--skuid.visualforce.com/apex/skuid__oauthcallback
    • https://<myDomain>--c.visualforce.com/apex/oauthcallback

    If the org’s My Domain is configured, their format should be:

    • https://<myDomain>--skuid.<Instance>.visual.force.com/apex/skuid__oauthcallback
    • https://<myDomain>--c.<Instance>. visual.force.com/apex/oauthcallback

    If the org’s My Domain is not configured, then the URLs will be:

    • https://skuid.<Instance>.visual.force.com/apex/skuid__oauthcallback
    • https://c.<Instance>.visual.force.com/apex/oauthcallback

    If the org is a developer’s edition or sandbox, the skuid/c section of the URL will be prepended with -dev-ed– or –sandboxName– respectively.

In SharePoint

Create a SharePoint App / OAuth client

In order for Skuid to connect to SharePoint Online using OAuth 2.0, you must register a SharePoint Online “App”, which is a named OAuth Client.

  1. Login to your SharePoint Online account.

  2. Navigate to the Register an App page at https://<CompanyName>.sharepoint.com/_layouts/15/appregnew.aspx (where <CompanyName> is your SharePoint Online company name).

    • For example, if the company name is Acme, the location would be:

      https://acme.sharepoint.com/_layouts/15/appregnew.aspx

  3. Client Id: Click Generate.

  4. Client Secret: Click Generate.

    Note

    Copy the generated client Id and secret and store in a secure place. You’ll need them later in this process.

  5. Title: Use a name that is descriptive.

  6. App Domain: Use the app domain as noted in the Prerequisites section.

  7. Redirect URI: Use the redirect URI as noted in the Prerequisites section.

  8. Click Create.

Edit the App Permissions

Next, edit the SharePoint App’s permissions to define the client’s access to the SharePoint Online instance.

  1. Navigate to

    https://<CompanyName>.sharepoint.com/_layouts/15/appinv.aspx, and make the following edits:

    • App ID: Enter the App’s Client Id (previous section, Step 3) into the App Id field.

      • Click Lookup to search for the App in the SharePoint Online instance’s registered apps.
      • Select the app.
    • Permission Request XML: This XML determines the permissions for your Sharepoint app. Refer to Microsoft documentation to properly determine the best permissions settings for your app.

      The examples below will assume the following Permission Request XML:

      <AppPermissionRequests>
      <AppPermissionRequest
      Scope="http://sharepoint/content/sitecollection"
      Right="Write" />
      </AppPermissionRequests>
      

    Note

    You may want to change the “Write” in Right=”Write” to one of the following:

    • Read
    • Write
    • Manage
    • Full Control
  2. Click Create to apply these changes to your App.

  3. If presented with a “Do you trust …?” screen, click Trust It.

In Skuid

Create an authentication provider that uses the SharePoint app’s client ID and secret.

Create an authentication provider

  1. Navigate to Configure > Data Sources > Authentication Providers.

  2. Click New Authentication Provider.

  3. Fill out the necessary fields:

    • Name: Enter a unique name, such as SharePoint_Auth

    • Authentication Method: OAuth 2.0 / OpenID

    • Provider Type: SharePoint Online

    • Grant Type: Authorization Code

    • Company Name: Your SharePoint Online Company Name.

    • Site Collection Path: Depending on the company’s SharePoint Online setup, it may be necessary to indicate the site collection path.

      Note

      Entering Company Name (and, if required, Site Collection Path) will auto-populate the following fields:

      • The Authorize and Token Endpoint URLs
      • Token Request Body Parameters
    • Client ID: Enter the Sharepoint app’s client ID (see the previous section).

    • Client Secret: Enter the Sharepoint app’s client secret (see the previous section.

  4. Click Save.

  5. If asked to create Remote Site Settings, click OK.

Create a data source

With the authentication provider configured, create a data source that uses it to authenticate and gain access to SharePoint data.

  1. Navigate to Configure > Data Sources > New Data Sources.
  2. Click New Data Source.
  3. Select the SharePoint data source type.
  4. Enter a unique name for your data source, such as SharePointOnline.
  5. Click Next Step.
  6. Enter the required information as noted below:
    • URL/Endpoint: https://<CompanyName>.sharepoint.com/_api where <CompanyName> is your SharePoint Online company name.
    • OData Version: 3
    • Check Use Proxy / Use Apex Proxy.
    • Authentication Method: Authentication Provider
      • Authentication Provider: Select the authentication provider you created in the previous section.
  7. Click Save.
  8. If Skuid asks to create a Remote Site Setting, click OK.

You can now use your SharePoint data source within a model on a Skuid page.

Connect using the Sharepoint__SharedLogin authentication provider

Note

This authentication option is only available for Skuid on Salesforce users.

To use the Sharepoint_SharedLogin authentication provider, you must save at least one set of Sharepoint username and password credentials within Skuid.

After saving these credentials, complete the following steps:

  1. Decide on a credentialing option
  2. Create the SharePoint data source
  3. Create a Remote Site setting for the SharePoint instance

Credential Options

Before creating the data source type, decide on the type of credentialing the data source will use.

Shared: Org-Wide credentials

With this option, all end users share a single Sharepoint login.

Warning

This option is not recommended unless all Skuid users have equal permissions for all data in the SharePoint instance.

Shared: Per-Profile credentials

If you have properly assigned data source profiles and permissions and would prefer to have logins shared by those profiles, select Shared: Per-Profile, with optional Org-Wide Default option.

Create a data source

  1. Navigate to Configure > Data Sources > New Data Sources.
  2. Click New Data Source.
  3. Select the SharePoint data source type.
  4. Enter a unique name for your data source, such as SharePointOnline.
  5. Click Next Step.
  6. Enter the URL of the Sharepoint database that allows API access. This should be similar to https://<CompanyName>.sharepoint.com/_api where <CompanyName> is your SharePoint Online company name.
  7. Check Use Apex Proxy.
  8. For Authentication:
    • Authentication Method: Authentication Provider (OAuth, Custom, etc)
    • Authentication Provider: SharePoint_SharedLogin.
  9. Credential Source: (See the previous section for details on these options)
    • Shared: Org-Wide
    • Shared: Per-Profile, with optional Org-wide Default
    • Per-User, with optional Profile / Org-wide Defaults

Once the Credential Source is selected, two new fields open. If using Shared: Org Wide, or using the option Org-wide default for the other two options, enter the following information:

  • Org-wide default username

  • Org-wide default password

    Note

    These credentials will NOT be visible or accessible to Skuid page users, but Skuid will use these credentials to authenticate users when making requests to SharePoint Online.

  1. Click Save.
  2. Skuid will ask to create a Remote Site Setting. Click OK.

Remote Site Settings

Skuid automatically created the Remote Site Setting for the actual Sharepoint instance (see Step 11, above); you must manually setup a Remote Site Setting for the Microsoft login URL that Skuid uses to authenticate to SharePoint Online.

In Salesforce Setup:

  1. Navigate to Security Controls > Remote Site Settings.
  2. Click New Remote Site.
  3. Give the Remote Site a descriptive name (something like “Skuid_Sharepoint_SharedLogin”).
  4. For the Remote Site URL, enter https://login.microsoftonline.com.
  5. Click Save.

If using Shared: Per-Profile credentials

After saving the data source and creating the Remote Site settings, find the data source in the list of data sources (Configure > Data Sources) and click Advanced Settings next to the SharePoint data source.

  1. Click Profile Credentials in the top right of the configuration area.
  2. Click fa-plus-circle Add to create new credential sets with the following fields:
    • Applies to: Select from the picklist.
    • Username
    • Password

Using the Sharepoint Data Source Type

After configuring your authentication and data source settings, you can create models that reference Sharepoint objects.

In a Skuid page, click fa-plus-circle Add Model to create a new model, then edit the model:

  • Name: Give the model a name
  • Data Source Type: Sharepoint.
  • Data Source: Select the data source that points to your Sharepoint database.

If using OAuth authentication [[]]

At the first use of this data source, Skuid opens a popup asking you to log into the Sharepoint app. Once logged in, SharePoint will display a screen asking, “Do you trust [the Skuid Sharepoint app title]?” Click Trust It.

When this is complete, the SharePoint object list will populate allowing you to select SharePoint external objects.

Warning

The browser may block this popup. In Google Chrome‚ for instance, a red X and a window icon appears in the URL bar.

  1. Click on the icon, and then click Always allow popups from…

  2. Click Done.

  3. Click on this icon again, then click on the link that was blocked to open it up.

    Other browsers will have similar processes to unblock popups.

  4. Select the SharePoint External Object from the picklist.

    • Model Label and Model Plural Label fields: enter appropriate labels.
  5. Add Fields and Conditions, etc. to the model, as needed. Click Save.

  6. Save and then Preview the page.

You can now use your SharePoint data source within a model on a Skuid page.

Using Sharepoint with the File Upload Component

You may use the File Upload File Upload Component to upload files to SharePoint. If you select a Sharepoint model for your File Upload Data Source Type, the following fields will appear:

  • File Storage Location: relative_server_url
    • This default value simply means files will be sent to the URL specified during data source configuration. This value the cannot be changed.
  • Label: Entering a label will insert custom text for the upload button. Leaving this field blank will result in a button that simply says Upload.
  • File Name: Use this field to rename any files uploaded through the file component.
    • This field is compatible with Merge Syntax.
    • If this field is blank, files will retain their original name.
  • Relative folder URL: The parameter Skuid will append to the File Storage location URL.
  • Update Metadata: Specify what, if any, metadata values will be sent to SharePoint along with the uploaded file. These values will update column records in the Sharepoint folder set as the storage location. Column values are updated by name-value pairs, which are separated by a colon and then delimited with a comma.

For example, if your SharePoint folder has an OpportunityName and RecordID column, inserting "OpportunityName:KrakenConsulting, RecordID:0001" into this field would update the OpportunityName column record for the uploaded file to KrakenConsulting and the RecordId column record to 0001.

Data Source Actions

  • Download File: Commonly used as a row action with the SP.Files entity, this action downloads a file.
    • File URL (Required): The URL Skuid uses to download files. Accepts merge syntax. In most use cases, this value should be {{Url}}.

Note

  • Ensure that your SP.Files model is pulling in the Url field.
  • Folders cannot be downloaded and will deliver an error page to the end user if an attempt is made. If using this action type in a row action, use display logic to display the action when Size != 0, as folders do not have a file size in Sharepoint.

Troubleshooting

I’m having issues connecting to my instance [[]]

  • If using OAuth to connect to Sharepoint, verify that the authentication provider is properly configured.

    Most importantly—even if the Company Name and Site Collection path properties have been set—ensure that the <Company Name> and <Site Collection Path>``values have been updated in the **authorize endpoint URL** and the ``<Company Name> value has been updated in the token endpoint URL.

  • If issues continue, try creating a remote site setting for https://<Company Name>.sharepoint.com/_api/$metadata, where <Company Name> matches the name of your organization.

Nothing appears when I try to select a model object. [[]]

General debugging [[]]