Skip to content

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

ParameterTypeDescription
ctxContextThe SDK context.
tokenstringAccess token from getSharePointTokenUserAuth.
options{ driveId: string; filePath: string; arrayBuffer: ArrayBuffer; }The upload options.
options.driveIdstringThe drive ID.
options.filePathstringThe destination path in the drive.
options.arrayBufferArrayBufferThe 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);

Matterway Assistant SDK Documentation