# Create a Sharepoint Connection

{% hint style="warning" %}
**Attention:** Before you connect **Sharepoint**, please make sure that you have already completed the [**Entra ID integration**](https://docs.en.theblockbrain.ai/for-admins/classic-microsoft-integrations/entra-id-integration)**!**
{% endhint %}

## 1. **Create a New Sites Admin App**

Go to the Overview page and obtain the `Application (client) ID` and `Directory (tenant) ID`. \
Save this information in a text file.

{% hint style="success" %}
We will only need the Admin App in this step to assign permissions to your Target App and credentials are not persisted. Optionally you can also delete the Admin App after the full setup process.
{% endhint %}

<details>

<summary>Still want to avoid Admin App Permissions?</summary>

If you prefer to avoid giving admin app permissions, please integrate using[sharepoint-manual-site-setup](https://docs.en.theblockbrain.ai/for-admins/classic-microsoft-integrations/create-a-sharepoint-connection/sharepoint-manual-site-setup "mention").&#x20;

*(This will require you to use **PnP PowerShell** or **Microsoft Graph API** to manually grant the app access to specific SharePoint sites)*

</details>

<figure><img src="https://t36648312.p.clickup-attachments.com/t36648312/92a29ac3-7b40-4d77-b9e7-72fd26615fe8/image.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://t36648312.p.clickup-attachments.com/t36648312/3c40fcb3-5f24-4931-a469-ff9d5cce622e/image.png" alt=""><figcaption></figcaption></figure>

## **2. Grant Graph API Permission**

1. Navigate to `API permission` and `+ Add a permission` there. Use the `Application permission` option there.                &#x20;

<figure><img src="https://t36648312.p.clickup-attachments.com/t36648312/3fb0629b-574a-49cb-b950-e55db328c37c/image.png" alt=""><figcaption><p>Always use application permissions instead of delegated permissions</p></figcaption></figure>

2. In the Sites Admin App Registration, grant Graph API permissions for **`Application.Read.All`, `Sites.FullControl.All`.**&#x20;

<details>

<summary>Important: Why Sites.FullControl.All?</summary>

The far-reaching rights (Sites.FullControl.All) are only required for the one-off setup. Specifically:

1. **Admin Application:**

* The Admin App only needs Sites.FullControl.All to assign the required authorizations to the target application.
* The access data of the Admin App is not saved permanently.

2. **After setup:**

* During operation, only the target application accesses SharePoint - and only the sites that are actually relevant.
* The rights of the target application are restricted accordingly.

3. **Optional:**

* The admin app can even be deleted again once setup is complete.

**Conclusion:**\
The extensive rights are only temporary and only necessary for the initial configuration. During subsequent operation, only the minimum required rights are used.

</details>

<figure><img src="https://3232460952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIabFtGTeQzwfWCzp8vd6%2Fuploads%2FCxfm3nqHcow2eGnbJiCE%2FScreenshot%202024-05-20%20at%2010.06.22.png?alt=media&#x26;token=60e0cf17-1869-4b99-9111-b051dce5c597" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3232460952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIabFtGTeQzwfWCzp8vd6%2Fuploads%2FGQgkTXtQYm3biHhBxN6n%2Fimage%20(3).png?alt=media&#x26;token=1301f471-95fa-4fb7-a007-6799e17b76be" alt=""><figcaption></figcaption></figure>

3. With admin rights, click the **`Grant admin consent`** link to approve the permissions.

<figure><img src="https://3232460952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIabFtGTeQzwfWCzp8vd6%2Fuploads%2FIRMOh0TG3g9zVV4Tbzh7%2FScreenshot%202024-05-20%20at%2010.12.58.png?alt=media&#x26;token=54c10e32-e071-4e19-8c9b-56865206075b" alt=""><figcaption></figcaption></figure>

## 3. Create a Client Secret Key

1. Navigate to the **`Certificates & Secrets`** page to create client secrets.

<figure><img src="https://t36648312.p.clickup-attachments.com/t36648312/9bb5a567-3bfb-4310-acb0-0b7f0e180957/image.png" alt=""><figcaption></figcaption></figure>

2. Copy the **Secret Key Value** (NOT the Secret ID) to the text file containing the Client ID and Tenant ID.

<figure><img src="https://t36648312.p.clickup-attachments.com/t36648312/5ce7a77c-fff2-4e54-ba79-b60da6227d12/image.png" alt=""><figcaption></figcaption></figure>

3. Your text file should now include

<pre><code><strong>Client Id: 4dbceba4-*******-960918801231
</strong>Client Secret: JPz******************
Directory (tenant) ID: cef6ac5c-7bc6-*****-fdf0
</code></pre>

## **4. Create an additional Target Application**

1. Follow the same steps as above to register another application, which will serve as the target application for SharePoint integration.
2. Ensure that this application also has **`Sites.Selected`** permissions.

<figure><img src="https://3232460952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIabFtGTeQzwfWCzp8vd6%2Fuploads%2Fr8iWqTo5oy4n7YbvizTQ%2Fimage%20(4).png?alt=media&#x26;token=2e1c3e4b-dc62-43a1-b321-4e40b56515be" alt=""><figcaption></figcaption></figure>

3. After registering, create a new **Secret Key Value** (NOT the Secret ID) and save it. Your target app text file should now include:

<pre><code><strong>Client Id: 1ad09322-6c74-*****-8d736a2d9e92
</strong>Client Secret: Npn******************
Directory (tenant) ID: cef6ac5c-7bc6-*****-fdf05232c2f4
</code></pre>

## **5. Configure SharePoint Integration in Blockbrain**

{% hint style="warning" %}
**Attention:** At this point you will have 2 Azure Apps configured (Admin and Target). \
If not, go back to step [#id-4.-create-an-additional-target-application](#id-4.-create-an-additional-target-application "mention").
{% endhint %}

1. Access the **`Integrations`** Panel in Blockbrain by clicking on the **`Admin`** button at the top right corner of the screen.&#x20;

<figure><img src="https://3232460952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIabFtGTeQzwfWCzp8vd6%2Fuploads%2FTUhiYJnCJsof2fTRD2Cz%2FBildschirmfoto%202025-09-23%20um%2009.19.16.png?alt=media&#x26;token=a72a9315-2bdd-44d6-baee-e646b89f3f35" alt=""><figcaption></figcaption></figure>

2. In the Integrations section, click on the SharePoint Integrations **`Connect`** button to begin setting up the integration.

<figure><img src="https://3232460952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIabFtGTeQzwfWCzp8vd6%2Fuploads%2FLIIxbfhXOX2R17mp9MDI%2FScreenshot%202025-03-06%20at%2015.49.08.png?alt=media&#x26;token=3437cdc0-7e19-4e29-ad51-ee55cd8ad19e" alt=""><figcaption></figcaption></figure>

3. Choose the **`SharePoint Site Discovery (Admin Key Required)`** option.

{% hint style="warning" %}
**Attention:** If you prefer to avoid giving admin access permissions with the **`SharePoint Site Setup (No Admin Key)`** Option, please refer to[sharepoint-manual-site-setup](https://docs.en.theblockbrain.ai/for-admins/classic-microsoft-integrations/create-a-sharepoint-connection/sharepoint-manual-site-setup "mention").&#x20;
{% endhint %}

<figure><img src="https://3232460952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIabFtGTeQzwfWCzp8vd6%2Fuploads%2FaqthsqdOOAifj8IvwRBS%2FScreenshot%202025-07-21%20at%2015.38.21-20250721-083827%20(1).png?alt=media&#x26;token=0bcf7b05-a055-498b-9717-ea0691ebc92d" alt=""><figcaption></figcaption></figure>

4. Enter the **Admin Azure App Details** in the pop-up window that will appear for configuring the integration.

* **`Application (client) ID`** (Admin App)
* **`Secret Key Value`** (NOT the Secret ID - of the Admin App)
* **`Directory (tenant) ID`** (Admin App)

<figure><img src="https://3232460952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIabFtGTeQzwfWCzp8vd6%2Fuploads%2FEtvC7zOO7KK6LaPA0ATh%2FScreenshot%202025-03-06%20at%2016.46.47.png?alt=media&#x26;token=a3c5ff71-f8a8-4f03-a7e5-061ae8340d70" alt=""><figcaption></figcaption></figure>

5. Fetch all available sites by click on **`Get Sites`**. The system will display a list of SharePoint sites that you can connect to.

<figure><img src="https://3232460952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIabFtGTeQzwfWCzp8vd6%2Fuploads%2Fdo1NdcPnLfG2yK6zZ67a%2FScreenshot%202025-03-06%20at%2016.35.58.png?alt=media&#x26;token=f3922c5b-859e-42d6-8ecf-cc35d1202378" alt=""><figcaption></figcaption></figure>

6. From the list of available sites, **select the ones you want to integrate** with Blockbrain. Multiple sites can be selected by clicking on each option. Click on the **`Next`** button to finalise.

{% hint style="success" %}
You can aways change the connected Sites later by selecting new ones in this view or deselecting the ones you want to disconnect.
{% endhint %}

<figure><img src="https://3232460952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIabFtGTeQzwfWCzp8vd6%2Fuploads%2FncTkDI5oW5ZKVfYCaunp%2FScreenshot%202025-03-06%20at%2016.36.44.png?alt=media&#x26;token=bdc693a3-9519-4b67-abc9-94578b62fd5b" alt=""><figcaption></figcaption></figure>

7. In the final configuration screen, enter the **Target Azure App Details from** [#id-4.-create-an-additional-target-application](#id-4.-create-an-additional-target-application "mention") and click on the **`Save`** button to connect.

* **`Application (client) ID`** (Target App)
* **`Secret Key Value`** (NOT the Secret ID - of the Target App)

<figure><img src="https://3232460952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIabFtGTeQzwfWCzp8vd6%2Fuploads%2FxHk5nUhdhHOEC2NoryUu%2FScreenshot%202025-03-06%20at%2016.44.48.png?alt=media&#x26;token=ca89f909-9ae3-4378-9536-357202e82a21" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
**Data Disconnection Warning:**

Be aware that **all data in the old SharePoint folder will be disconnected** when you proceed with the integration. Ensure that you are ready to disconnect the old folder before saving.
{% endhint %}

## 6. Connect a Sharepoint Site as Knowledge Base

1. To connect a site to a knowledge base and use it with a bot, follow the instructions in [connect-a-sharepoint-site-as-knowledge-base](https://docs.en.theblockbrain.ai/for-admins/classic-microsoft-integrations/create-a-sharepoint-connection/connect-a-sharepoint-site-as-knowledge-base "mention")

## Best Practices & Troubleshooting <a href="#id-5.-best-practices-and-troubleshooting" id="id-5.-best-practices-and-troubleshooting"></a>

* **Credentials Accuracy**\
  Double‑check **`Client ID`**, **`Client Secret Key`**, and **`Tenant ID`** against your Azure AD app.
* **API Permissions**\
  Confirm the Azure AD app has been granted and consented for the required Graph scopes.
