> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/m/microsoft-sharepoint.md).

# Microsoft Sharepoint

Microsoft SharePoint lists can hold asset records that no other adapter reaches. This adapter reads one SharePoint list through Microsoft Graph and turns each row into a device.

## Use cases

* List the devices that come from your SharePoint list.

```
Adapters = microsoft-sharepoint
```

* Find list devices that were not updated for 90 days.

```
Adapters = microsoft-sharepoint AND NOT LastSeen last now-90d/d
```

## Before you begin

### Network

| Source              | Destination               | Port | Protocol |
| ------------------- | ------------------------- | ---- | -------- |
| OctoXLabs connector | login.microsoftonline.com | 443  | HTTPS    |
| OctoXLabs connector | graph.microsoft.com       | 443  | HTTPS    |

### Required permissions

| Scope or role                                 | Permission | Needed for                                                      |
| --------------------------------------------- | ---------- | --------------------------------------------------------------- |
| Sites.Read.All (Microsoft Graph, application) | Read       | Reading the SharePoint site and list items                      |
| Files.Read.All (Microsoft Graph, application) | Read       | Listed in the frontend instructions for the SharePoint adapters |

The permission list comes from the frontend instructions of the SharePoint adapters.

## Create credentials in Microsoft Sharepoint

{% stepper %}
{% step %}

### Register an application

Sign in to the Azure Portal as an administrator, open Azure Active Directory and select App registrations > New registration. Fill in the details and select Register. The Application (client) ID and Directory (tenant) ID are shown.
{% endstep %}

{% step %}

### Create a client secret

Select Certificates & Secrets > New client secret. Select Add and copy the generated secret value at once.
{% endstep %}

{% step %}

### Add API permissions

Select API Permissions > Add a permission > Microsoft Graph > Application permissions. Add Sites.Read.All and Files.Read.All.
{% endstep %}

{% step %}

### Grant admin consent

Select Grant admin consent.
{% endstep %}

{% step %}

### Find the list address

Your list URL has the form `https://SharepointDomain/FolderType/YourSite/Lists/ListName`. You need the domain, folder type, site address and list name from it.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
These SharePoint adapters read one SharePoint list. Each list row becomes one asset. You tell OctoXLabs which list column holds each field. Enter column names without spaces. Columns you do not map stay available as adapter specific data under their display names.
{% endhint %}

## Connection parameters

| Parameter                               | Required | Type            | Default | Description                                                                |
| --------------------------------------- | -------- | --------------- | ------- | -------------------------------------------------------------------------- |
| Tenant ID (`tenant_id`)                 | Yes      | String          |         | Directory (tenant) ID.                                                     |
| Client ID (`client_id`)                 | Yes      | String          |         | Application (client) ID.                                                   |
| Client Secret (`client_secret`)         | Yes      | String          |         | Client secret value.                                                       |
| Sharepoint Domain (`sharepoint_domain`) | Yes      | String          |         | Host name of the site collection, for example `yourtenant.sharepoint.com`. |
| Folder Type (`folder_type`)             | Yes      | String          |         | Folder type of the site collection, for example `personal` or `marketing`. |
| Site Address (`site_address`)           | Yes      | String          |         | Server-relative path of the site, for example `your_site_com`.             |
| List Name (`list_name`)                 | Yes      | String          |         | Name of the list. It is the last part of the list URL.                     |
| SSL (`is_secure`)                       | No       | Boolean         | True    | Use HTTPS for the token request.                                           |
| Timeout (`timeout`)                     | No       | Integer         | 30      | Seconds to wait for API responses.                                         |
| Hostname Field (`hostname_field`)       | Yes      | String          |         | List column that holds the host name (for example `Title`).                |
| IP Address Field (`ip_address_field`)   | No       | String          |         | List column that holds the IP address.                                     |
| First Seen Field (`first_seen_field`)   | No       | String          |         | List column that holds the first seen date.                                |
| Last Seen Field (`last_seen_field`)     | No       | String          |         | List column that holds the last seen date.                                 |
| Date Fields (`date_fields`)             | No       | List of strings | Empty   | List columns to read as dates.                                             |
| Day First (`day_first`)                 | No       | Boolean         | False   | Read ambiguous dates as day first.                                         |

## Troubleshooting

| Error message | Cause | Fix                                    |
| ------------- | ----- | -------------------------------------- |
| Not verified  |       | No adapter-specific error text in code |

## Change history

{% hint style="info" %}
Available starting from version 5.4.2.
{% endhint %}
