Appearance
Function: uploadFile()
ts
function uploadFile(client: Client, options: {
siteId: string;
driveId: string;
folderId: string;
fileName: string;
file: MwFile;
}): Promise<void>;Defined in: src/ms-graph/sharepointGraph.ts:239
Upload a file to a folder in a SharePoint drive.
Parameters
| Parameter | Type | Description |
|---|---|---|
client | Client | The Microsoft Graph client instance. |
options | { siteId: string; driveId: string; folderId: string; fileName: string; file: MwFile; } | The upload options. |
options.siteId | string | The SharePoint site ID. |
options.driveId | string | The drive ID. |
options.folderId | string | The destination folder ID. |
options.fileName | string | The file name for the upload. |
options.file | MwFile | The MwFile to upload. |
Returns
Promise<void>
A promise that resolves when the upload finishes.
Example
ts
const client = await getMsGraphClient(creds);
await uploadFile(client, {
siteId: 'site-id',
driveId: 'drive-id',
folderId: 'folder-id',
fileName: 'annual-report.pdf',
file: reportFile,
});