Appearance
Function: copyFile()
ts
function copyFile(client: Client, options: {
fileId: string;
driveId: string;
destinationFolderId: string;
destinationDriveId: string;
name: string;
}): Promise<void>;Defined in: src/ms-graph/sharepointGraph.ts:312
Copy a file to another location in SharePoint.
Parameters
| Parameter | Type | Description |
|---|---|---|
client | Client | The Microsoft Graph client instance. |
options | { fileId: string; driveId: string; destinationFolderId: string; destinationDriveId: string; name: string; } | The copy options. |
options.fileId | string | The source file ID. |
options.driveId | string | The source drive ID. |
options.destinationFolderId | string | The destination folder ID. |
options.destinationDriveId | string | The destination drive ID. |
options.name | string | The name for the copied file. |
Returns
Promise<void>
A promise that resolves when the copy completes.
Example
ts
const client = await getMsGraphClient(creds);
await copyFile(client, {
fileId: 'original-file-id',
driveId: 'source-drive',
destinationFolderId: 'archive-folder',
destinationDriveId: 'archive-drive',
name: 'budget-backup.xlsx',
});