Function getDriveItems

  • Retrieves the items (folders and files) from the root of a specified drive.

    Parameters

    • client: Client

      The Microsoft Graph client instance used to make requests.

    • options: {
          driveId: string;
          siteId: string;
      }

      An object containing the siteId and driveId.

      • driveId: string

        The ID of the drive to retrieve items from.

      • siteId: string

        The ID of the SharePoint site.

    Returns Promise<any>

    A promise that resolves to an array of drive items.

    const client = await getSharePointClient(opt);
    const options = { siteId: 'your-site-id', driveId: 'your-drive-id' };
    const items = await getDriveItems(client, options);
    console.log(items);