# SharePoint (/integrations/sharepoint)





{/* MANUAL-CONTENT-START:intro */}

Use [SharePoint](https://www.microsoft.com/en-us/microsoft-365/sharepoint/collaboration) in Sim to list sites, manage pages and lists, update list items, and upload or download files. Connect a Microsoft account through OAuth, then choose the target site or resource for each operation.

{/* MANUAL-CONTENT-END */}

## OAuth scopes [#oauth-scopes]

Sim requests these scopes when someone connects a SharePoint account. For a self-hosted deployment, register your own app with the provider using the settings below. See [Integrations and OAuth](/platform/self-hosting/integrations-oauth) for setup.

| Setting | Value |
| - | - |
| Redirect URI | `<NEXT_PUBLIC_APP_URL>/api/auth/oauth2/callback/sharepoint` |
| Environment variables | `MICROSOFT_CLIENT_ID`, `MICROSOFT_CLIENT_SECRET` |

| Scope | Description |
| - | - |
| `openid` | Standard authentication |
| `profile` | Access profile information |
| `email` | Access email address |
| `Sites.Read.All` | Read documents and list items in all SharePoint sites |
| `Sites.ReadWrite.All` | Create, edit, and delete documents and list items in all SharePoint sites |
| `Sites.Manage.All` | Create and delete lists and document libraries in all SharePoint sites |
| `offline_access` | Access account when not using the application |

## Use the block [#usage-instructions]

Read/create pages, list sites, and work with lists (read, create, update items). Requires OAuth.

## Actions [#actions]

### Create SharePoint Page [#create-sharepoint-page]

Create a new page in a SharePoint site

<ReferenceDetails>
  #### Input [#input]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `siteId` | string | No | The ID of the SharePoint site (internal use) |
  | `siteSelector` | string | No | Select the SharePoint site |
  | `pageName` | string | Yes | The name of the page to create. Example: My-New-Page.aspx or Report-2024.aspx |
  | `pageTitle` | string | No | The title of the page (defaults to page name if not provided) |
  | `pageContent` | string | No | The content of the page |

  #### Output [#output]

  | Parameter | Type | Description |
  | - | - | - |
  | `page` | object | Created SharePoint page information |
  | ↳ `id` | string | The unique ID of the created page |
  | ↳ `name` | string | The name of the created page |
  | ↳ `title` | string | The title of the created page |
  | ↳ `webUrl` | string | The URL to access the page |
  | ↳ `pageLayout` | string | The layout type of the page |
  | ↳ `createdDateTime` | string | When the page was created |
  | ↳ `lastModifiedDateTime` | string | When the page was last modified |
</ReferenceDetails>

### Read SharePoint Page [#read-sharepoint-page]

Read a specific page from a SharePoint site

<ReferenceDetails>
  #### Input [#input-1]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `siteSelector` | string | No | Select the SharePoint site |
  | `siteId` | string | No | The ID of the SharePoint site (internal use) |
  | `pageId` | string | No | The ID of the page to read. Example: a GUID like 12345678-1234-1234-1234-123456789012 |
  | `pageName` | string | No | The name of the page to read (alternative to pageId). Example: Home.aspx or About-Us.aspx |
  | `maxPages` | number | No | Maximum number of pages to return when listing all pages (default: 10, max: 50) |
  | `nextPageUrl` | string | No | Full @odata.nextLink URL from a previous Microsoft Graph page response |

  #### Output [#output-1]

  | Parameter | Type | Description |
  | - | - | - |
  | `page` | object | Information about the SharePoint page |
  | ↳ `id` | string | The unique ID of the page |
  | ↳ `name` | string | The name of the page |
  | ↳ `title` | string | The title of the page |
  | ↳ `webUrl` | string | The URL to access the page |
  | ↳ `pageLayout` | string | The layout type of the page |
  | ↳ `description` | string | The description of the page |
  | ↳ `createdDateTime` | string | When the page was created |
  | ↳ `lastModifiedDateTime` | string | When the page was last modified |
  | `pages` | array | List of SharePoint pages |
  | ↳ `page` | object | |
  | ↳ `id` | string | The unique ID of the page |
  | ↳ `name` | string | The name of the page |
  | ↳ `title` | string | The title of the page |
  | ↳ `webUrl` | string | The URL to access the page |
  | ↳ `pageLayout` | string | The layout type of the page |
  | ↳ `description` | string | The description of the page |
  | ↳ `createdDateTime` | string | When the page was created |
  | ↳ `lastModifiedDateTime` | string | When the page was last modified |
  | ↳ `content` | object | |
  | ↳ `content` | string | Extracted text content from the page |
  | ↳ `canvasLayout` | object | Raw SharePoint canvas layout structure |
  | `content` | object | Content of the SharePoint page |
  | ↳ `content` | string | Extracted text content from the page |
  | ↳ `canvasLayout` | object | Raw SharePoint canvas layout structure |
  | `totalPages` | number | Total number of pages found |
  | `nextPageUrl` | string | Full Microsoft Graph @odata.nextLink URL for the next page of results |
</ReferenceDetails>

### Update SharePoint Page [#update-sharepoint-page]

Update the title and/or content of a SharePoint page

<ReferenceDetails>
  #### Input [#input-2]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `siteId` | string | No | The ID of the SharePoint site (internal use) |
  | `siteSelector` | string | No | Select the SharePoint site |
  | `pageId` | string | Yes | The ID of the page to update. Example: a GUID like 12345678-1234-1234-1234-123456789012 |
  | `pageTitle` | string | No | The new title of the page |
  | `pageContent` | string | No | The new text content of the page. Replaces the entire canvas layout of the page. |

  #### Output [#output-2]

  | Parameter | Type | Description |
  | - | - | - |
  | `page` | object | Updated SharePoint page information |
  | ↳ `id` | string | The unique ID of the page |
  | ↳ `name` | string | The name of the page |
  | ↳ `title` | string | The title of the page |
  | ↳ `webUrl` | string | The URL to access the page |
  | ↳ `pageLayout` | string | The layout type of the page |
  | ↳ `createdDateTime` | string | When the page was created |
  | ↳ `lastModifiedDateTime` | string | When the page was last modified |
</ReferenceDetails>

### Publish SharePoint Page [#publish-sharepoint-page]

Publish the latest version of a SharePoint page, making it available to all users

<ReferenceDetails>
  #### Input [#input-3]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `siteSelector` | string | No | Select the SharePoint site |
  | `siteId` | string | No | The ID of the SharePoint site (internal use) |
  | `pageId` | string | Yes | The ID of the page to publish. Example: a GUID like 12345678-1234-1234-1234-123456789012 |

  #### Output [#output-3]

  | Parameter | Type | Description |
  | - | - | - |
  | `published` | boolean | Whether the page was published |
  | `pageId` | string | The ID of the published page |
</ReferenceDetails>

### Delete SharePoint Page [#delete-sharepoint-page]

Delete a page from a SharePoint site

<ReferenceDetails>
  #### Input [#input-4]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `siteSelector` | string | No | Select the SharePoint site |
  | `siteId` | string | No | The ID of the SharePoint site (internal use) |
  | `pageId` | string | Yes | The ID of the page to delete. Example: a GUID like 12345678-1234-1234-1234-123456789012 |

  #### Output [#output-4]

  | Parameter | Type | Description |
  | - | - | - |
  | `deleted` | boolean | Whether the page was deleted |
  | `pageId` | string | The ID of the deleted page |
</ReferenceDetails>

### List SharePoint Sites [#list-sharepoint-sites]

List details of all SharePoint sites

<ReferenceDetails>
  #### Input [#input-5]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `siteSelector` | string | No | Select the SharePoint site |
  | `siteId` | string | No | The ID of the SharePoint site (internal use) |
  | `groupId` | string | No | The group ID for accessing a group team site. Example: a GUID like 12345678-1234-1234-1234-123456789012 |
  | `nextPageUrl` | string | No | Full @odata.nextLink URL from a previous Microsoft Graph page response |

  #### Output [#output-5]

  | Parameter | Type | Description |
  | - | - | - |
  | `site` | object | Information about the current SharePoint site |
  | ↳ `id` | string | The unique ID of the site |
  | ↳ `name` | string | The name of the site |
  | ↳ `displayName` | string | The display name of the site |
  | ↳ `webUrl` | string | The URL to access the site |
  | ↳ `description` | string | The description of the site |
  | ↳ `createdDateTime` | string | When the site was created |
  | ↳ `lastModifiedDateTime` | string | When the site was last modified |
  | ↳ `isPersonalSite` | boolean | Whether this is a personal site |
  | ↳ `root` | object | Present (as an empty object) only when this site is the root of its site collection |
  | ↳ `siteCollection` | object | |
  | ↳ `hostname` | string | Site collection hostname |
  | `sites` | array | List of all accessible SharePoint sites |
  | ↳ `id` | string | The unique ID of the site |
  | ↳ `name` | string | The name of the site |
  | ↳ `displayName` | string | The display name of the site |
  | ↳ `webUrl` | string | The URL to access the site |
  | ↳ `description` | string | The description of the site |
  | ↳ `createdDateTime` | string | When the site was created |
  | ↳ `lastModifiedDateTime` | string | When the site was last modified |
  | `nextPageUrl` | string | Full Microsoft Graph @odata.nextLink URL for the next page of results |
</ReferenceDetails>

### Create SharePoint List [#create-sharepoint-list]

Create a new list in a SharePoint site

<ReferenceDetails>
  #### Input [#input-6]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `siteId` | string | No | The ID of the SharePoint site (internal use) |
  | `siteSelector` | string | No | Select the SharePoint site |
  | `listDisplayName` | string | Yes | Display name of the list to create. Example: Project Tasks or Customer Contacts |
  | `listDescription` | string | No | Description of the list |
  | `listTemplate` | string | No | List template name (e.g., 'genericList') |
  | `pageContent` | json | No | Optional JSON of columns. Either a top-level array of column definitions or an object with \{ columns: \[...] }. |

  #### Output [#output-6]

  | Parameter | Type | Description |
  | - | - | - |
  | `list` | object | Created SharePoint list information |
  | ↳ `id` | string | The unique ID of the list |
  | ↳ `displayName` | string | The display name of the list |
  | ↳ `name` | string | The internal name of the list |
  | ↳ `webUrl` | string | The web URL of the list |
  | ↳ `createdDateTime` | string | When the list was created |
  | ↳ `lastModifiedDateTime` | string | When the list was last modified |
  | ↳ `list` | object | List properties (e.g., template) |
</ReferenceDetails>

### Get SharePoint List [#get-sharepoint-list]

Get metadata (and optionally columns/items) for a SharePoint list

<ReferenceDetails>
  #### Input [#input-7]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `siteSelector` | string | No | Select the SharePoint site |
  | `siteId` | string | No | The ID of the SharePoint site (internal use) |
  | `listId` | string | No | The ID of the list to retrieve. Example: b!abc123def456 or a GUID like 12345678-1234-1234-1234-123456789012 |
  | `includeColumns` | boolean | No | Whether to include column definitions when retrieving a specific list |
  | `includeItems` | boolean | No | Whether to include list items when retrieving a specific list |
  | `nextPageUrl` | string | No | Full @odata.nextLink URL from a previous Microsoft Graph page response |

  #### Output [#output-7]

  | Parameter | Type | Description |
  | - | - | - |
  | `list` | object | Information about the SharePoint list |
  | ↳ `id` | string | The unique ID of the list |
  | ↳ `displayName` | string | The display name of the list |
  | ↳ `name` | string | The internal name of the list |
  | ↳ `webUrl` | string | The web URL of the list |
  | ↳ `createdDateTime` | string | When the list was created |
  | ↳ `lastModifiedDateTime` | string | When the list was last modified |
  | ↳ `list` | object | List properties (e.g., template) |
  | ↳ `columns` | array | List column definitions |
  | ↳ `items` | array | List items (with fields when expanded) |
  | ↳ `id` | string | Item ID |
  | ↳ `fields` | object | Field values for the item |
  | `lists` | array | All lists in the site when no listId/title provided |
  | `items` | array | List items with expanded fields when reading list items |
  | ↳ `id` | string | Item ID |
  | ↳ `fields` | object | Field values for the item |
  | `nextPageUrl` | string | Full Microsoft Graph @odata.nextLink URL for the next page of results |
</ReferenceDetails>

### Update SharePoint List Item [#update-sharepoint-list-item]

Update the properties (fields) on a SharePoint list item

<ReferenceDetails>
  #### Input [#input-8]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `siteSelector` | string | No | Select the SharePoint site |
  | `siteId` | string | No | The ID of the SharePoint site (internal use) |
  | `listId` | string | Yes | The ID of the list containing the item. Example: b!abc123def456 or a GUID like 12345678-1234-1234-1234-123456789012 |
  | `itemId` | string | Yes | The ID of the list item to update. Example: 1, 42, or 123 |
  | `listItemFields` | json | Yes | Field values to update on the list item |

  #### Output [#output-8]

  | Parameter | Type | Description |
  | - | - | - |
  | `item` | object | Updated SharePoint list item |
  | ↳ `id` | string | Item ID |
  | ↳ `fields` | object | Updated field values |
</ReferenceDetails>

### Add SharePoint List Item [#add-sharepoint-list-item]

Add a new item to a SharePoint list

<ReferenceDetails>
  #### Input [#input-9]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `siteSelector` | string | No | Select the SharePoint site |
  | `siteId` | string | No | The ID of the SharePoint site (internal use) |
  | `listId` | string | Yes | The ID of the list to add the item to. Example: b!abc123def456 or a GUID like 12345678-1234-1234-1234-123456789012 |
  | `listItemFields` | json | Yes | Field values for the new list item |

  #### Output [#output-9]

  | Parameter | Type | Description |
  | - | - | - |
  | `item` | object | Created SharePoint list item |
  | ↳ `id` | string | Item ID |
  | ↳ `fields` | object | Field values for the new item |
</ReferenceDetails>

### Get SharePoint List Item [#get-sharepoint-list-item]

Get a single item (with field values) from a SharePoint list

<ReferenceDetails>
  #### Input [#input-10]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `siteSelector` | string | No | Select the SharePoint site |
  | `siteId` | string | No | The ID of the SharePoint site (internal use) |
  | `listId` | string | Yes | The ID of the list containing the item. Example: b!abc123def456 or a GUID like 12345678-1234-1234-1234-123456789012 |
  | `itemId` | string | Yes | The ID of the list item to retrieve. Example: 1, 42, or 123 |

  #### Output [#output-10]

  | Parameter | Type | Description |
  | - | - | - |
  | `item` | object | SharePoint list item with field values |
  | ↳ `id` | string | Item ID |
  | ↳ `fields` | object | Field values for the item |
</ReferenceDetails>

### Delete SharePoint List Item [#delete-sharepoint-list-item]

Delete an item from a SharePoint list

<ReferenceDetails>
  #### Input [#input-11]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `siteSelector` | string | No | Select the SharePoint site |
  | `siteId` | string | No | The ID of the SharePoint site (internal use) |
  | `listId` | string | Yes | The ID of the list containing the item. Example: b!abc123def456 or a GUID like 12345678-1234-1234-1234-123456789012 |
  | `itemId` | string | Yes | The ID of the list item to delete. Example: 1, 42, or 123 |

  #### Output [#output-11]

  | Parameter | Type | Description |
  | - | - | - |
  | `deleted` | boolean | Whether the list item was deleted |
  | `itemId` | string | The ID of the deleted list item |
</ReferenceDetails>

### Upload File to SharePoint [#upload-file-to-sharepoint]

Upload files to a SharePoint document library

<ReferenceDetails>
  #### Input [#input-12]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `siteId` | string | No | The ID of the SharePoint site |
  | `driveId` | string | No | The ID of the document library (drive). If not provided, uses default drive. Example: b!abc123def456 |
  | `folderPath` | string | No | Optional folder path within the document library. Example: /Documents/Subfolder or /Shared Documents/Reports |
  | `fileName` | string | No | Optional: override the uploaded file name. Example: report-2024.pdf |
  | `files` | file\[] | Yes | Files to upload to SharePoint |

  #### Output [#output-12]

  | Parameter | Type | Description |
  | - | - | - |
  | `uploadedFiles` | array | Array of uploaded file objects |
  | ↳ `id` | string | The unique ID of the uploaded file |
  | ↳ `name` | string | The name of the uploaded file |
  | ↳ `webUrl` | string | The URL to access the file |
  | ↳ `size` | number | The size of the file in bytes |
  | ↳ `createdDateTime` | string | When the file was created |
  | ↳ `lastModifiedDateTime` | string | When the file was last modified |
  | `fileCount` | number | Number of files uploaded |
  | `skippedFiles` | array | Files that were skipped before upload |
  | ↳ `name` | string | File name |
  | ↳ `size` | number | File size in bytes |
  | ↳ `limit` | number | Upload size limit in bytes |
  | ↳ `reason` | string | Reason the file was skipped |
  | `skippedCount` | number | Number of files skipped |
  | `errors` | array | Per-file upload errors |
  | ↳ `name` | string | File name |
  | ↳ `error` | string | Error message |
  | ↳ `status` | number | HTTP status from Microsoft Graph |
</ReferenceDetails>

### Download File from SharePoint [#download-file-from-sharepoint]

Download a file from a SharePoint document library

<ReferenceDetails>
  #### Input [#input-13]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `driveId` | string | Yes | The ID of the document library (drive). Example: b!abc123def456 |
  | `driveItemId` | string | Yes | The ID of the file (drive item) to download |
  | `fileName` | string | No | Optional filename override (e.g., "report.pdf", "data.xlsx") |

  #### Output [#output-13]

  | Parameter | Type | Description |
  | - | - | - |
  | `file` | file | Downloaded file stored in execution files |
</ReferenceDetails>

### Get SharePoint Drive Item [#get-sharepoint-drive-item]

Get metadata for a file or folder in a SharePoint document library

<ReferenceDetails>
  #### Input [#input-14]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `driveId` | string | Yes | The ID of the document library (drive). Example: b!abc123def456 |
  | `driveItemId` | string | Yes | The ID of the file or folder (drive item) to retrieve |

  #### Output [#output-14]

  | Parameter | Type | Description |
  | - | - | - |
  | `driveItem` | object | Metadata for the SharePoint file or folder |
  | ↳ `id` | string | The unique ID of the drive item |
  | ↳ `name` | string | The name of the file or folder |
  | ↳ `webUrl` | string | The URL to access the item |
  | ↳ `size` | number | The size of the item in bytes |
  | ↳ `createdDateTime` | string | When the item was created |
  | ↳ `lastModifiedDateTime` | string | When the item was last modified |
  | ↳ `file` | object | Present if the item is a file (contains mimeType) |
  | ↳ `folder` | object | Present if the item is a folder (contains childCount) |
  | ↳ `parentReference` | object | Reference to the parent folder/drive |
</ReferenceDetails>

### Delete SharePoint File [#delete-sharepoint-file]

Delete a file (or folder) from a SharePoint document library

<ReferenceDetails>
  #### Input [#input-15]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `driveId` | string | Yes | The ID of the document library (drive). Example: b!abc123def456 |
  | `driveItemId` | string | Yes | The ID of the file (drive item) to delete |

  #### Output [#output-15]

  | Parameter | Type | Description |
  | - | - | - |
  | `deleted` | boolean | Whether the file was deleted |
  | `itemId` | string | The ID of the deleted file |
</ReferenceDetails>
