# Setting up a Sharepoint connector

<details>

<summary>Credentials setting in Azure</summary>

In this part, we will connect to Azure in order to authorize the Toucan App.

* Connect to Azure with an admin account : Azure Active Directory admin center.
* Click on Azure Active Directory, then on App registrations and then on New registration

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-2c38fb3fd3d5dfc8855a76f0223433dfc7cb4ef6%2Fsharepoint_1.png?alt=media" alt="sharepoint_1"><figcaption><p>sharepoint_1</p></figcaption></figure>

* Give a name to your app (for instance : Toucan) & define who can have access to this app. Click then on Register

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-ef5ea3e3082adc6f1a40a9b690c278ead1e9c8a5%2Fsharepoint_2.png?alt=media" alt="sharepoint_2"><figcaption><p>sharepoint_2</p></figcaption></figure>

Your app has been now declared on Azure. In the Overview screen you can have access to several informations :

* Application (client) ID -> it will correspond to the “Client ID” in Toucan.
* Directory (tenant) ID -> it will correspond to the “Tenant ID” in Toucan.

Now we will create a Client secret. To do so, go on the Certificated & secrets section, and click on New client secret:

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-f328f8259204294d46b25ad943be5f30a762898c%2Fsharepoint_3.png?alt=media" alt="sharepoint_3"><figcaption><p>sharepoint_3</p></figcaption></figure>

Give a name (field Description) to the client secret and set the validity period:

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-b21b74c013ff2ef1cf83a2d7d98c704c8b9d774f%2Fsharepoint_4.png?alt=media" alt="sharepoint_4"><figcaption><p>sharepoint_4</p></figcaption></figure>

The secret will appear just one time, so copy it now. You won’t be able to copy it again after !

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-a3617b71b8d930ad4afefe563155eefd676f43b1%2Fsharepoint_5.png?alt=media" alt="sharepoint_5"><figcaption><p>sharepoint_5</p></figcaption></figure>

Now that we created the client secret, we will define the “redirect URIs”. To do this, go on the Authentication section, then click on Add a platform, and select Web in the window on the right.

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-e2759a27200fdd42d9cfe5d5d84758812028eadb%2Fsharepoint_6.png?alt=media" alt="sharepoint_6"><figcaption><p>sharepoint_6</p></figcaption></figure>

Set the URI following your configuration (sub-domain, application name & connector\_name):`https://api-{sub_domain}.toucantoco.com/{application_name}/oauth/redirect?connector_name={connector_name}`

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-6852886a8c51482efe1ef51585d847cc8e486582%2Fsharepoint_7.png?alt=media" alt="sharepoint_7"><figcaption><p>sharepoint_7</p></figcaption></figure>

Note that the `connector_name` will be the one that we will specify after in Toucan as “name”. Once the URI has been defined, click on “Configure”.

* Go on the API permissions section, then click on Add a permission. Click on Microsoft Graph, then on Application permissions.

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-236acb8a1435b243319ab1449284de16bee3a38a%2Fsharepoint_8.png?alt=media" alt="sharepoint_8"><figcaption><p>sharepoint_8</p></figcaption></figure>

Add these 2 permissions : `Files.Read.All` & `User.Read`

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-49a498f7ecc93215bb80e68e970a9800a8ae2a30%2Fsharepoint_9.png?alt=media" alt="sharepoint_9"><figcaption><p>sharepoint_9</p></figcaption></figure>

**Sharepoint connector setting in Toucan:**

</details>

## Configuring a Sharepoint connection¶

| Field                                          | Format / Type | Description                                                                                                                                                                                                                                                                             | Example |
| ---------------------------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| Name (mandatory)                               | String        | Use it to identify your connection                                                                                                                                                                                                                                                      |         |
| Client ID (mandatory)                          | String        | corresponds to “Application (client) ID” in Azure                                                                                                                                                                                                                                       |         |
| Client Secret (mandatory)                      | String        | corresponds to the secret displayed after having added a new secret in Azure                                                                                                                                                                                                            |         |
| Scope (mandatory)                              | String        | The scope determines what type of access the app is granted when the user is signed in it can be set as “offline\_access Sites.Read.All”                                                                                                                                                |         |
| Tenant (mandatory)                             | String        | The tenant determines what part of your organisation you want to signed in corresponds to “Directory (tenant) ID” in Azure                                                                                                                                                              |         |
| Retry Policy (optional)                        | Boolean       | <p><em>Boolean</em> allows to configure a retry policy if the connection is flaky.</p><ul><li>max attempts: maximum number of retries before giving up</li><li>max\_delay: in seconds, above the connection is dropped</li><li>wait\_time: time in seconds between each retry</li></ul> |         |
| Slow Queries' Cache Expiration Time (optional) | Integer       | Slow queries' cache expiration time in seconds                                                                                                                                                                                                                                          |         |

## Create a dataset from a Sharepoint connection

Fields description :

`DOMAIN` : domain name of the dataset. `SITE URL` : URL of the sharepoint. `DOCUMENT LIBRARY` : library. `FILE` : file path. `SHEET` : sheet name in the file.

## Misc

### Error handling

When you get an error while configuring the connection, it might be a misleading information (fix in progress), try to move to the next step anyway. Click on Close, and then click on `Save`.

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-39fac3e93fa354c5517545eeb11bb8ecaee757ee%2Fsharepoint_11.png?alt=media" alt="sharepoint_11"><figcaption><p>sharepoint_11</p></figcaption></figure>

You might be redirected to Microsoft in order to authorize access. Accept the authorization:

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-fd9361715815016f1891fc33a6b9442206d17c4d%2Fsharepoint_12.png?alt=media" alt="sharepoint_12"><figcaption><p>sharepoint_12</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-v3.toucantoco.com/data-management-in-datahub/datasources-in-toucan/managing-connectors/setting-up-a-connector/online-services-connectors/setting-up-a-sharepoint-connector.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
