Appearance
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
| Parameter | Type | Description |
|---|---|---|
ctx | Context | The SDK context. |
token | string | Access token from getSharePointTokenUserAuth. |
options | { driveId: string; filePath: string; } | The drive and file path. |
options.driveId | string | The drive ID. |
options.filePath | string | The 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');