Skip to content

Function: getFileByPathEval()

ts
function getFileByPathEval(
   ctx: Context, 
   token: string, 
   options: {
  driveId: string;
  filePath: string;
}): Promise<ArrayBuffer>;

Defined in: src/ms-graph/sharepointGraphEval.ts:344

Get a file by its path from a SharePoint drive via the Graph API (browser eval variant).

Parameters

ParameterTypeDescription
ctxContextThe SDK context.
tokenstringAccess token from getSharePointTokenUserAuth.
options{ driveId: string; filePath: string; }The drive and file path.
options.driveIdstringThe drive ID.
options.filePathstringThe path to the file in the drive.

Returns

Promise<ArrayBuffer>

The file content as an ArrayBuffer.

Example

ts
const token = await getSharePointTokenUserAuth(ctx, authProps);
const content = await getFileByPathEval(ctx, token, {
  driveId: 'drive-abc123',
  filePath: 'Reports/quarterly-summary.pdf',
});
console.log('File size:', content.byteLength, 'bytes');

Matterway Assistant SDK Documentation