# SharePoint Microsoft Graph REST API Delegated

---

#### Remote item name: **SharePoint**

**Integration Type**: Delegated Permission

The Microsoft Graph API is a unified REST endpoint for all Microsoft 365 services, treating SharePoint simply as another data source alongside Teams, Outlook, and OneDrive. It allows you to access SharePoint resources like sites, drives, and list items through the single graph.microsoft.com endpoint, using a consolidated permission model.

---

**🛑 Proxy Configuration:** If your environment uses a Proxy or a strict Firewall, you must authorize outbound traffic to the following Microsoft endpoints.

• **login.microsoftonline.com**\
• **graph.microsoft.com**

---

Open the **Microsoft Entra Admin Center** (formerly Azure AD) to manage your app registration: [Microsoft Entra Admin Center Link](https://entra.microsoft.com/)

Navigation: Go to **App registrations**.\
![New registration](SharePoint-Integration/new_registration.png)

In the Redirect URI section, for Platform configuration, select **Web**. The Redirect URL must end with **register_microsoft_graph_api/**.

```

    http://localhost:9090/register_microsoft_graph_api/
    or
    https://your.crushftp.domain.com/register_microsoft_graph_api/
```

**Configure API Permission**: Navigate to API Permissions. Click on Add a permission button. Select Microsoft Graph. Then select **Delagated permissions**. Search for Files and check the flag **Files.ReadWrite.All** permission.

![Permission microsoft graph](SharePoint-Integration/permission_microsoft_graph.png)\
![Permission final](SharePoint-Integration/permission_final.png)

🛑 Important: **Admin consent** for the newly added permission.

![App permission admin consent](SharePoint-Integration/app_permission_admin_consent.png)

**Client id :** You can find it at Azure portal -> App Registration -> Overview:

![Client id](SharePoint-Integration/client_id.png)

**Client Secret**:

Go to Certificates & secrets, and generate a new client secret by clicking on New client secret. ⚠️ Ensure you copy over the **value** immediately!

![New secret](SharePoint-Integration/new_secret.png)

![Secret value](SharePoint-Integration/secret_value.png)

**🛑 Important**: To obtain the **Refresh Token**, the CrushFTP WebInterface’s host and port must match the **Redirect URL** specified in the **Azure App Registration**. In our example, it was: http<!-- -->://localhost:9090 or https<!-- -->://your.crushftp.domain.com/

Select the **Delegated Permission** radio button, then click **Get Refresh Token**.\
Enter the **Client ID** (See at App Registration -> Overview -> Application (client) ID), **Client Secret** (See at App Registration -> Manage -> Certificates & secrets) make sure to copy the **value** field, not the ID, and **Tenant ID** (See at App Registration -> Overview -> Directory (tenant) ID).

Click the **OK** button and proceed with the authentication and authorization process.

**🛑 Important**: Be sure to sign in with the Microsoft Account that has the necessary permissions, as configured in the Azure App Registration mentioned above.

This will automatically configure the username and password in the VFS item settings. After that, proceed with the SharePoint site-specific configuration.

![Remote item settings](SharePoint-Integration/remote_item_settings.png)

**Tennant:** See at App Registration -> Overview -> Directory (tenant) ID. Based on the App Registration Account type, it can be an ID, common, or consumer.

**Identifying the SharePoint Target**: You must define which part of SharePoint the VFS should connect to. You can either link to a **full Document Library** or a **specific subfolder**.

**Link an Entire Document Library**:

In your web browser, open your SharePoint site and navigate to the **Document Library**. Copy the complete URL from your browser's address bar.

![Shared link document library](SharePoint-Microsoft-Graph-REST-API/shared_link_document_library.png)

It will look similar to this:

```
https://your.sharepoint.com/sites/your_site/Shared%20Documents/Forms/AllItems.aspx
```

**Link a Specific Subfolder**: If you only want the VFS to access a specific subdirectory, use a **Direct Link**:

![Shared link specific folder](SharePoint-Microsoft-Graph-REST-API/shared_link_specific_folder.png)\
In your web browser, open your SharePoint site and navigate to the **Document Library**, and find the specific folder you want to link to. Right-click on the folder. Select **Copy link** from the context menu that appears.\
It will look similar to this:

```
https://your.sharepoint.com/:f:/s/your_site/Evxo0AjlwiZAnajkk56_AC0BDxGQDy7bgNu8F7HHgVMKtQ?e=BgvJps
```

Return to the VFS settings and paste the URL into the **Shared Link** input field.

Click the **Test** button to verify the connection. If successful, click **OK** and then Save your changes.

---

Back to [SharePoint Integration](SharePoint-Integration.md)

---
