Appearance
Function: getListItems()
ts
function getListItems(client: Client, options: {
siteId: string;
listId: string;
}): Promise<any[]>;Defined in: src/ms-graph/sharepointGraph.ts:97
Get all items from a SharePoint list. Paginate automatically until every item is fetched.
Parameters
| Parameter | Type | Description |
|---|---|---|
client | Client | The Microsoft Graph client instance. |
options | { siteId: string; listId: string; } | The site and list identifiers. |
options.siteId | string | The SharePoint site ID. |
options.listId | string | The SharePoint list ID. |
Returns
Promise<any[]>
An array of list items with expanded fields.
Example
ts
const client = await getMsGraphClient(creds);
const items = await getListItems(client, { siteId: 'site-id-123', listId: 'list-id-456' });
console.log('Total items:', items.length);