diff --git a/packages/nodes-base/nodes/Microsoft/OneDrive/FolderDescription.ts b/packages/nodes-base/nodes/Microsoft/OneDrive/FolderDescription.ts index a33f1302d6..16f1ccdf4d 100644 --- a/packages/nodes-base/nodes/Microsoft/OneDrive/FolderDescription.ts +++ b/packages/nodes-base/nodes/Microsoft/OneDrive/FolderDescription.ts @@ -20,6 +20,11 @@ export const folderOperations = [ value: 'create', description: 'Create a folder', }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a folder', + }, { name: 'Get Children', value: 'getChildren', @@ -91,7 +96,7 @@ export const folderFields = [ ], }, /* -------------------------------------------------------------------------- */ -/* folder:getChildren */ +/* folder:getChildren/delete */ /* -------------------------------------------------------------------------- */ { displayName: 'Folder ID', @@ -100,6 +105,7 @@ export const folderFields = [ displayOptions: { show: { operation: [ + 'delete', 'getChildren', ], resource: [ diff --git a/packages/nodes-base/nodes/Microsoft/OneDrive/MicrosoftOneDrive.node.ts b/packages/nodes-base/nodes/Microsoft/OneDrive/MicrosoftOneDrive.node.ts index e36076bd65..6afe17aae2 100644 --- a/packages/nodes-base/nodes/Microsoft/OneDrive/MicrosoftOneDrive.node.ts +++ b/packages/nodes-base/nodes/Microsoft/OneDrive/MicrosoftOneDrive.node.ts @@ -222,6 +222,13 @@ export class MicrosoftOneDrive implements INodeType { responseData = await microsoftApiRequest.call(this, 'POST', endpoint, body); returnData.push(responseData); } + //https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_delete?view=odsp-graph-online + if (operation === 'delete') { + const folderId = this.getNodeParameter('folderId', i) as string; + responseData = await microsoftApiRequest.call(this, 'DELETE', `/drive/items/${folderId}`); + responseData = { success: true }; + returnData.push(responseData as IDataObject); + } //https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_list_children?view=odsp-graph-online if (operation === 'getChildren') { const folderId = this.getNodeParameter('folderId', i) as string;