Skip to content

Function: deleteFile()

ts
function deleteFile(client: Client, options: {
  driveId: string;
  fileId: string;
}): Promise<void>;

Defined in: src/ms-graph/sharepointGraph.ts:274

Delete a file from a SharePoint drive.

Parameters

ParameterTypeDescription
clientClientThe Microsoft Graph client instance.
options{ driveId: string; fileId: string; }The file location.
options.driveIdstringThe drive ID.
options.fileIdstringThe file ID.

Returns

Promise<void>

A promise that resolves when the file is deleted.

Example

ts
const client = await getMsGraphClient(creds);
await deleteFile(client, { driveId: 'drive-id', fileId: 'obsolete-file-id' });
console.log('File deleted.');

Matterway Assistant SDK Documentation