Skip to content

Function: getDriveItems()

ts
function getDriveItems(client: Client, options: {
  driveId: string;
  siteId: string;
}): Promise<any>;

Defined in: packages/sdk/src/ms-graph/sharepointGraph.ts:143

Get all root-level items (files and folders) from a drive.

Parameters

ParameterTypeDescription
clientClientThe Microsoft Graph client instance.
options{ driveId: string; siteId: string; }The site and drive identifiers.
options.driveIdstringThe drive ID.
options.siteIdstringThe SharePoint site ID.

Returns

Promise<any>

An array of drive items at the root level.

Example

ts
const client = await getMsGraphClient(creds);
const items = await getDriveItems(client, { siteId: 'site-id', driveId: 'drive-id' });
items.forEach((item: any) => console.log(item.name, item.size));

Matterway Assistant SDK Documentation