> 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-users.md).

# Microsoft Sharepoint Users

This adapter reads one SharePoint list through Microsoft Graph and turns each row into a user.

## Use cases

* List the users that come from your SharePoint list.

```
Adapters = microsoft-sharepoint-users
```

* Find list users who have not logged on for 90 days.

```
Adapters = microsoft-sharepoint-users AND NOT LastLogOnTime 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 Users

{% 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.                                         |
| Email Field (`email_field`)                     | Yes      | String  |         | List column that holds the email address.                                  |
| First Name Field (`first_name_field`)           | No       | String  |         | List column for the first name.                                            |
| Last Name Field (`last_name_field`)             | No       | String  |         | List column for the last name.                                             |
| Display Name Field (`display_name_field`)       | No       | String  |         | List column for the display name.                                          |
| Username Field (`username_field`)               | No       | String  |         | List column for the username.                                              |
| Created Time Field (`created_time_field`)       | No       | String  |         | List column for the creation time.                                         |
| Last Logon Time Field (`last_logon_time_field`) | No       | String  |         | List column for the last logon time.                                       |

## Troubleshooting

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

## Change history
