🔀 Merge branch 'RicardoE105-feature/extended-one-drive' into oauth-support

This commit is contained in:
Jan Oberhauser 2020-03-30 08:56:25 +02:00
commit ca551ea75c
3 changed files with 37 additions and 0 deletions

View file

@ -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 */
/* -------------------------------------------------------------------------- */

View file

@ -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) {

View file

@ -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;