Skip to content

Function: copyFileEval()

ts
function copyFileEval(
   ctx: Context, 
   token: string, 
   options: {
  driveId: string;
  parentId: string;
  fileId: string;
  newFileName: string;
}): Promise<boolean>;

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

Copy a file in a SharePoint drive via the Graph API (browser eval variant).

Parameters

ParameterTypeDescription
ctxContextThe SDK context.
tokenstringAccess token from getSharePointTokenUserAuth.
options{ driveId: string; parentId: string; fileId: string; newFileName: string; }The copy options.
options.driveIdstringThe drive ID containing the file.
options.parentIdstringThe destination parent folder ID.
options.fileIdstringThe source file ID.
options.newFileNamestringThe name for the copied file.

Returns

Promise<boolean>

True if the copy succeeded.

Example

ts
const token = await getSharePointTokenUserAuth(ctx, authProps);
const copied = await copyFileEval(ctx, token, {
  driveId: 'drive-abc123',
  parentId: 'archive-folder-id',
  fileId: 'original-file-id',
  newFileName: 'budget-backup.xlsx',
});
console.log('Copied:', copied);

Matterway Assistant SDK Documentation