Matterway
    Preparing search index...

    Function getFile

    • Retrieves the content of a file from a specified drive in SharePoint.

      Parameters

      • client: Client

        The Microsoft Graph client instance used to make the request.

      • options: { driveId: string; fileId: string; responseType?: ResponseType }

        An object containing the necessary parameters to identify the file.

        • driveId: string

          The ID of the drive containing the file.

        • fileId: string

          The ID of the file to retrieve.

        • OptionalresponseType?: ResponseType

          Optional. The type of response expected (e.g., arraybuffer, blob, etc.). Defaults to ResponseType.ARRAYBUFFER.

      Returns Promise<any>

      A promise that resolves to the file content.

      const client = await getSharePointClient(opt);
      const options = {
      driveId: 'drive-id',
      fileId: 'file-id',
      responseType: ResponseType.BLOB,
      };
      const file = await getFile(client, options);
      console.log(file);