Appearance
Function: uploadFileEval()
ts
function uploadFileEval(
ctx: Context,
token: string,
options: {
driveId: string;
filePath: string;
arrayBuffer: ArrayBuffer;
}): Promise<any>;Defined in: src/ms-graph/sharepointGraphEval.ts:420
Upload a file to 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; arrayBuffer: ArrayBuffer; } | The upload options. |
options.driveId | string | The drive ID. |
options.filePath | string | The destination path in the drive. |
options.arrayBuffer | ArrayBuffer | The file content as an ArrayBuffer. |
Returns
Promise<any>
The upload response object from the Graph API.
Example
ts
const token = await getSharePointTokenUserAuth(ctx, authProps);
const response = await uploadFileEval(ctx, token, {
driveId: 'drive-abc123',
filePath: 'Uploads/recipe-book.pdf',
arrayBuffer: fileBuffer,
});
console.log('Uploaded file ID:', response.id);