mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 20:54:07 -08:00
🔀 Merge branch 'RicardoE105-feature/extended-one-drive' into oauth-support
This commit is contained in:
commit
ca551ea75c
|
@ -13,6 +13,11 @@ export const folderOperations = [
|
|||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a folder',
|
||||
},
|
||||
{
|
||||
name: 'Get Children',
|
||||
value: 'getChildren',
|
||||
|
@ -31,6 +36,27 @@ export const folderOperations = [
|
|||
|
||||
export const folderFields = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* folder:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
required: true,
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'folder',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: `Folder's name`,
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* folder:getChildren */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
|
|
@ -33,6 +33,7 @@ export async function microsoftApiRequest(this: IExecuteFunctions | IExecuteSing
|
|||
if (Object.keys(body).length === 0) {
|
||||
delete options.body;
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
return await this.helpers.requestOAuth.call(this, 'microsoftOneDriveOAuth2Api', options);
|
||||
} catch (error) {
|
||||
|
|
|
@ -193,6 +193,16 @@ export class MicrosoftOneDrive implements INodeType {
|
|||
}
|
||||
}
|
||||
if (resource === 'folder') {
|
||||
//https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_post_children?view=odsp-graph-online
|
||||
if (operation === 'create') {
|
||||
const name = this.getNodeParameter('name', i) as string;
|
||||
const body: IDataObject = {
|
||||
name,
|
||||
folder: {},
|
||||
};
|
||||
responseData = await microsoftApiRequest.call(this, 'POST', '/drive/root/children', body);
|
||||
returnData.push(responseData);
|
||||
}
|
||||
//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;
|
||||
|
|
Loading…
Reference in a new issue