mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-30 06:59:41 -08:00
🔀 Merge pull request #452 from RicardoE105/feature/extended-onedrive
⚡ Added subfolders
This commit is contained in:
commit
e9b3a32a14
|
@ -57,6 +57,32 @@ export const folderFields = [
|
||||||
default: '',
|
default: '',
|
||||||
description: `Folder's name`,
|
description: `Folder's name`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Options',
|
||||||
|
name: 'options',
|
||||||
|
type: 'collection',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'create',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'folder',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: {},
|
||||||
|
placeholder: 'Add Field',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Parent Folder ID',
|
||||||
|
name: 'parentFolderId',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'ID of the folder you want to crate the new folder in',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* folder:getChildren */
|
/* folder:getChildren */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
|
@ -196,11 +196,16 @@ export class MicrosoftOneDrive implements INodeType {
|
||||||
//https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_post_children?view=odsp-graph-online
|
//https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_post_children?view=odsp-graph-online
|
||||||
if (operation === 'create') {
|
if (operation === 'create') {
|
||||||
const name = this.getNodeParameter('name', i) as string;
|
const name = this.getNodeParameter('name', i) as string;
|
||||||
|
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||||
const body: IDataObject = {
|
const body: IDataObject = {
|
||||||
name,
|
name,
|
||||||
folder: {},
|
folder: {},
|
||||||
};
|
};
|
||||||
responseData = await microsoftApiRequest.call(this, 'POST', '/drive/root/children', body);
|
let endpoint = '/drive/root/children';
|
||||||
|
if (options.parentFolderId) {
|
||||||
|
endpoint = `/drive/items/${options.parentFolderId}/children`;
|
||||||
|
}
|
||||||
|
responseData = await microsoftApiRequest.call(this, 'POST', endpoint, body);
|
||||||
returnData.push(responseData);
|
returnData.push(responseData);
|
||||||
}
|
}
|
||||||
//https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_list_children?view=odsp-graph-online
|
//https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_list_children?view=odsp-graph-online
|
||||||
|
|
Loading…
Reference in a new issue