# List Items — Sharepoint

> Get the collection of items in a SharePoint list, including their field values. Supports OData filtering and field selection. See the documentation

- Key: `sharepoint-list-items`
- Type: Action (Read-only)
- Version: 0.0.1
- App: Sharepoint (`sharepoint`) — https://pipedream.com/apps/sharepoint.md
- This page (HTML): https://pipedream.com/apps/sharepoint/actions/list-items
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/sharepoint/actions/list-items/list-items.mjs

## Description

Get the collection of items in a SharePoint list, including their field values. Supports OData filtering and field selection. [See the documentation](https://learn.microsoft.com/en-us/graph/api/listitem-list?view=graph-rest-1.0&tabs=http)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `siteId` | `string` | Yes | The ID of the SharePoint site. Use the List Sites action to find available sites and their IDs. Accepts a composite ID (e.g. contoso.sharepoint.com,<guid>,<guid>) or a server-relative path (e.g. contoso.sharepoint.com:/sites/site-name). |
| `listId` | `string` | Yes | The ID of the SharePoint list. Use the List Lists action to find lists and their IDs. The ID is also available in the list URL or on the List Settings page in SharePoint (Settings → List Settings → the List query parameter in the page URL). |
| `filter` | `string` | No | An OData filter expression to narrow results (e.g. fields/Status eq 'Active' or fields/Quantity lt 100). The Title column and most custom columns are not indexed by default — when filtering on these, set Honor Non-Indexed Queries to true to avoid errors. |
| `select` | `string` | No | A comma-separated list of column names to include in each item's fields object (e.g. Title,Status,AssignedTo). When omitted, all fields are returned. Column names are case-sensitive. |
| `maxResults` | `integer` | No | The maximum number of results to return |
| `honorNonIndexedQueries` | `boolean` | No | Enable filtering on non-indexed columns. Recommended when filtering on Title or custom columns, which are not indexed by default. Sends the Prefer: HonorNonIndexedQueriesWarningMayFailRandomly header — queries may fail randomly on very large lists (above the list view threshold of 5,000 items), but works reliably for typical list sizes. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "sharepoint",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "sharepoint-list-items",
  arguments: {
    siteId: "Site ID",
    listId: "List ID",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "sharepoint-list-items",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    sharepoint: { authProvisionId: "apn_xxxxxxx" },
    siteId: "Site ID",
    listId: "List ID",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "sharepoint-list-items",
    "configured_props": {
      "sharepoint": { "authProvisionId": "apn_xxxxxxx" },
      "siteId": "Site ID",
      "listId": "List ID"
    }
  }'
```

---

- App: https://pipedream.com/apps/sharepoint.md · All apps: https://pipedream.com/apps
