# Manually Grant SharePoint Site Access

{% hint style="warning" %}
**Prerequisites:** Before proceeding, ensure you have **Site Admin rights** on the target SharePoint site. You can verify this by navigating to `_layouts/15/mngsiteadmin.aspx` on your SharePoint site. Additionally, the SharePoint site permissions must be set to **Full Access** for this step to work.

You can use **PnP PowerShell** or **Microsoft Graph API** to grant the app access to specific SharePoint sites with only **`Read`** permission.

* 🔗 [PnP PowerShell Documentation](https://pnp.github.io/powershell/cmdlets/Grant-PnPAzureADAppSitePermission.html)
* 🔗 [Microsoft Graph API Documentation](https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins-modernize/understanding-rsc-for-msgraph-and-sharepoint-online) (shown below)
  {% endhint %}

## 1. Create an Admin App

1. Create Admin App with **`Sites.FullControl.All`** permission. For a step-by-step guide, check the admin app section on[Create a Sharepoint Connection](/for-admins/classic-microsoft-integrations/create-a-sharepoint-connection.md).

## 2. Get access token of Admin App by Postman

1. Use the **`Client Id`**, **`Client Secret Key`**, **`Tenant Id`** of the Admin App to **`POST`** to **`https://login.microsoftonline.com/<tenant_id>/oauth2/token`**

<figure><img src="/files/2jBS6uV6JIl6WX0CXSyq" alt=""><figcaption></figcaption></figure>

## 3. Get the Sharepoint site id

1. Create a **`GET`** request to **`https://graph.microsoft.com/v1.0/sites/`** with the **`access_token`** from the previous step as **`Bearer Token`** auth and save the returned **`id` .**

<figure><img src="/files/fDveAfDUKG6SPc5CtXbc" alt=""><figcaption></figcaption></figure>

## 4. **Assign** SharePoint site **permission to target application**

1. Create a **`POST`** request to **`http://graph.microsoft.com/v1.0/sites/<site_id>/permissions`** with the following JSON payload:

```json
{
    "roles": [
        "read"
    ],
    "grantedToIdentities": [
        {
            "application": {
                "id": YOUR_TARGET_APPLICATION_ID,
                "displayName": "displayName"
            }
        }
    ]
}
```

<figure><img src="/files/j1vasshFIPg4nLfNYJWh" alt=""><figcaption></figcaption></figure>

## 5. Add Sharepoint site on Blockbrain platform

1. Continue with **`5. Configure SharePoint Integration in Blockbrain`** on [Sharepoint Manual Site Setup](/for-admins/classic-microsoft-integrations/create-a-sharepoint-connection/sharepoint-manual-site-setup.md)


---

# 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.blockbrain.ai/for-admins/classic-microsoft-integrations/create-a-sharepoint-connection/sharepoint-manual-site-setup/manually-grant-sharepoint-site-access.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.
