Skip to main content
Skip table of contents

SharePoint File as Data Source

Setup AzureAD

Add New App Registration

Add a new registration under App registrations > New registration.

Tipp: When naming the new app, choosing a recognisable name like External Data for Jira Fields can help you to properly identify the application later.

For the option "Who can use this application or access this API?" select Single tenant.

Certificates & Secret

Go to Certificates & secrets > Client secrets > New client secret

Add a meaningful description and set an expiration date. Keep in mind that you’ll have to update the data source once the secret expires.

Important: Please make sure to note down the secret value, which is only visible immediately after creation. You will need this value later when setting up the data source

API Permissions

Go to API permissions > Add a permission

Select Microsoft Graph > Application permissions

Now select the API / PermissionFile.Read.All and Sites.Read.All permission.

This permission needs Admin consent so we allow Grant admin consent for ...

Collect Endpoint & ClientID

Go to Overview > Endpoints and copy the following endpoint:

CODE
OAuth 2.0 token endpoint (v2)

Go to Overview > Application (client) ID and note the value.

Setup External Data

Create New Data Source

Create a new data source under External Data for Jira Fields > Data Sources > Add Data Source.

Authentication:

Select Authentication OAuth2 > Grant Type > Client Credentials

Client ID & Client Secret

Enter the Client ID, which you can find at Overview > Application (client) ID

The Client Secret is the secret value created in the Certificates & secrets section. Please insert the noted value here.

Endpoints

Endpoints are service specific URLs for receiving an access token. Since we are using the client credentials flow, we only need the token endpoint.

Token Endpoints:

CODE
Token Url: https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token

Scopes

Scopes define the permission to specific parts of the data. Since we are using the Client Credentials Flow, we simply set the scope to:

CODE
https://graph.microsoft.com/.default

Make sure that an administrator grants you the required permissions that you need for setting up the Azure backend configuration.

Authenticate

Click Authenticate to retrieve your access token.

URL

We need 3 steps to get the correct endpoint for one file.

Our example SharePoint JSON Document looks like this and we will try to get the support.json file.

Step 1: Get SharePoint Site ID

Now we need to get the SharePoint Site ID where the document library is located by using the following url:

CODE
https://graph.microsoft.com/v1.0/sites/{host-name}:/{server-relative-path}

In our example:

https://graph.microsoft.com/v1.0/sites/w04ss.sharepoint.com:/sites/w04ss

Result:

Copy the value of id.

Step 2: Get Document Libraries from a SharePoint Site

CODE
https://graph.microsoft.com/v1.0/sites/{site-id}/drives

Replace {site-id} with the result value of id from the "Get SharePoint Site ID" request.

In our example:

CODE
https://graph.microsoft.com/v1.0/sites/w04ss.sharepoint.com,6769358c-5ce8-40be-bb78-bd8e4269d577,8ba6337a-c6a9-4b24-aa0e-b1d722ad302f/drives

Result:

Copy the value of id for the document library you want to use.

Step 3: Get a Specific File content from a Document Library

CODE
https://graph.microsoft.com/v1.0/sites/{site-id}/drives/{drive-id}/root:/{item-path}:/content

Replace:

{site-id} with the result value of id from the "Get SharePoint Site ID" request
{drive-id} with the result value of id from the "Get Document Libraries" request

{item-path} with the path and filename

In our example:

https://graph.microsoft.com/v1.0/sites/w04ss.sharepoint.com,6769358c-5ce8-40be-bb78-bd8e4269d577,8ba6337a-c6a9-4b24-aa0e-b1d722ad302f/drives/b!jDVpZ-hcvkC7eL2OQmnVd3ozpoupxiRLqg6x1yKtMC-sjqKV7dRPSaJGD3Yis5c-/root:/support.json:/content

Result:


Save and test the data source to ensure that everything works as intended.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.