first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled

This commit is contained in:
2026-03-17 16:22:57 +03:30
commit 3d5eaf9445
15349 changed files with 2847338 additions and 0 deletions
@@ -0,0 +1,35 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('Test MicrosoftOutlookV2, calendar => create', () => {
nock('https://graph.microsoft.com/v1.0/me')
.post(
'/calendarGroups/AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRu_AAA=/calendars',
{ color: 'lightOrange', name: 'New Calendar' },
)
.reply(200, {
'@odata.context':
"https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/calendarGroups('AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRu_AAA%3D')/calendars/$entity",
id: 'AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAAFXBBZ_AAA=',
name: 'New Calendar',
color: 'lightOrange',
hexColor: '#fcab73',
isDefaultCalendar: false,
changeKey: 'WX+A3vy5K0qqTyPHso1JgAABVtwWTA==',
canShare: true,
canViewPrivateItems: true,
canEdit: true,
allowedOnlineMeetingProviders: ['teamsForBusiness'],
defaultOnlineMeetingProvider: 'teamsForBusiness',
isTallyingResponses: false,
isRemovable: true,
owner: {
name: 'User Name',
address: 'test@mail.com',
},
});
new NodeTestHarness().setupTests({
workflowFiles: ['create.workflow.json'],
});
});
@@ -0,0 +1,92 @@
{
"name": "My workflow 21",
"nodes": [
{
"parameters": {},
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
820,
360
]
},
{
"parameters": {
"resource": "calendar",
"operation": "create",
"name": "New Calendar",
"additionalFields": {
"calendarGroup": "AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRu_AAA=",
"color": "lightOrange"
}
},
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
"name": "Microsoft Outlook",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
1040,
360
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "iXJCki7i5Vz0bdks",
"name": "Microsoft Outlook account 2"
}
}
}
],
"pinData": {
"Microsoft Outlook": [
{
"json": {
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/calendarGroups('AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRu_AAA%3D')/calendars/$entity",
"id": "AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAAFXBBZ_AAA=",
"name": "New Calendar",
"color": "lightOrange",
"hexColor": "#fcab73",
"isDefaultCalendar": false,
"changeKey": "WX+A3vy5K0qqTyPHso1JgAABVtwWTA==",
"canShare": true,
"canViewPrivateItems": true,
"canEdit": true,
"allowedOnlineMeetingProviders": [
"teamsForBusiness"
],
"defaultOnlineMeetingProvider": "teamsForBusiness",
"isTallyingResponses": false,
"isRemovable": true,
"owner": {
"name": "User Name",
"address": "test@mail.com"
}
}
}
]
},
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Microsoft Outlook",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "074cdbef-4193-45b8-970a-9f55b8a0999b",
"id": "1CYHzBXQw1nfPGtB",
"meta": {
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
},
"tags": []
}
@@ -0,0 +1,14 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('Test MicrosoftOutlookV2, calendar => delete', () => {
nock('https://graph.microsoft.com/v1.0/me')
.delete(
'/calendars/AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvIAAA=',
)
.reply(200);
new NodeTestHarness().setupTests({
workflowFiles: ['delete.workflow.json'],
});
});
@@ -0,0 +1,74 @@
{
"name": "My workflow 21",
"nodes": [
{
"parameters": {},
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
820,
360
]
},
{
"parameters": {
"resource": "calendar",
"operation": "delete",
"calendarId": {
"__rl": true,
"value": "AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvIAAA=",
"mode": "list",
"cachedResultName": "Foo"
}
},
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
"name": "Microsoft Outlook",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
1040,
360
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "iXJCki7i5Vz0bdks",
"name": "Microsoft Outlook account 2"
}
}
}
],
"pinData": {
"Microsoft Outlook": [
{
"json": {
"success": true
}
}
]
},
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Microsoft Outlook",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "888e5578-c726-4a84-9658-321ba04fd0c7",
"id": "1CYHzBXQw1nfPGtB",
"meta": {
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
},
"tags": []
}
@@ -0,0 +1,34 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('Test MicrosoftOutlookV2, calendar => get', () => {
nock('https://graph.microsoft.com/v1.0/me')
.get(
'/calendars/AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvGAAA=',
)
.reply(200, {
'@odata.context':
"https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/calendars/$entity",
id: 'AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvGAAA=',
name: 'Foo Calendar',
color: 'lightGreen',
hexColor: '#87d28e',
isDefaultCalendar: false,
changeKey: 'WX+A3vy5K0qqTyPHso1JgAAAi67hiw==',
canShare: true,
canViewPrivateItems: true,
canEdit: true,
allowedOnlineMeetingProviders: ['teamsForBusiness'],
defaultOnlineMeetingProvider: 'teamsForBusiness',
isTallyingResponses: false,
isRemovable: true,
owner: {
name: 'User Name',
address: 'test@mail.com',
},
});
new NodeTestHarness().setupTests({
workflowFiles: ['get.workflow.json'],
});
});
@@ -0,0 +1,93 @@
{
"name": "My workflow 21",
"nodes": [
{
"parameters": {},
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
820,
360
]
},
{
"parameters": {
"resource": "calendar",
"operation": "get",
"calendarId": {
"__rl": true,
"value": "AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvGAAA=",
"mode": "list",
"cachedResultName": "Foo Calendar"
}
},
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
"name": "Microsoft Outlook",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
1040,
360
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "iXJCki7i5Vz0bdks",
"name": "Microsoft Outlook account 2"
}
}
}
],
"pinData": {
"Microsoft Outlook": [
{
"json": {
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/calendars/$entity",
"id": "AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvGAAA=",
"name": "Foo Calendar",
"color": "lightGreen",
"hexColor": "#87d28e",
"isDefaultCalendar": false,
"changeKey": "WX+A3vy5K0qqTyPHso1JgAAAi67hiw==",
"canShare": true,
"canViewPrivateItems": true,
"canEdit": true,
"allowedOnlineMeetingProviders": [
"teamsForBusiness"
],
"defaultOnlineMeetingProvider": "teamsForBusiness",
"isTallyingResponses": false,
"isRemovable": true,
"owner": {
"name": "User Name",
"address": "test@mail.com"
}
}
}
]
},
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Microsoft Outlook",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "33e1fc57-ac36-453b-b01e-d79784b4a4bb",
"id": "1CYHzBXQw1nfPGtB",
"meta": {
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
},
"tags": []
}
@@ -0,0 +1,53 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('Test MicrosoftOutlookV2, calendar => getAll', () => {
nock('https://graph.microsoft.com/v1.0/me')
.get('/calendars?%24filter=canEdit%20eq%20true&%24top=2')
.reply(200, {
value: [
{
id: 'AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAAAJ9-JDAAA=',
name: 'Calendar',
color: 'auto',
hexColor: '',
isDefaultCalendar: true,
changeKey: 'WX+A3vy5K0qqTyPHso1JgAAACfdHfw==',
canShare: true,
canViewPrivateItems: true,
canEdit: true,
allowedOnlineMeetingProviders: ['teamsForBusiness'],
defaultOnlineMeetingProvider: 'teamsForBusiness',
isTallyingResponses: true,
isRemovable: false,
owner: {
name: 'User Name',
address: 'test@mail.com',
},
},
{
id: 'AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvBAAA=',
name: 'Third calendar',
color: 'lightYellow',
hexColor: '#fde300',
isDefaultCalendar: false,
changeKey: 'WX+A3vy5K0qqTyPHso1JgAAAi67hIw==',
canShare: true,
canViewPrivateItems: true,
canEdit: true,
allowedOnlineMeetingProviders: ['teamsForBusiness'],
defaultOnlineMeetingProvider: 'teamsForBusiness',
isTallyingResponses: false,
isRemovable: true,
owner: {
name: 'User Name',
address: 'test@mail.com',
},
},
],
});
new NodeTestHarness().setupTests({
workflowFiles: ['getAll.workflow.json'],
});
});
@@ -0,0 +1,112 @@
{
"name": "My workflow 21",
"nodes": [
{
"parameters": {},
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
820,
360
]
},
{
"parameters": {
"resource": "calendar",
"limit": 2,
"filters": {
"custom": "canEdit eq true"
}
},
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
"name": "Microsoft Outlook",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
1040,
360
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "iXJCki7i5Vz0bdks",
"name": "Microsoft Outlook account 2"
}
}
}
],
"pinData": {
"Microsoft Outlook": [
{
"json": {
"id": "AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAAAJ9-JDAAA=",
"name": "Calendar",
"color": "auto",
"hexColor": "",
"isDefaultCalendar": true,
"changeKey": "WX+A3vy5K0qqTyPHso1JgAAACfdHfw==",
"canShare": true,
"canViewPrivateItems": true,
"canEdit": true,
"allowedOnlineMeetingProviders": [
"teamsForBusiness"
],
"defaultOnlineMeetingProvider": "teamsForBusiness",
"isTallyingResponses": true,
"isRemovable": false,
"owner": {
"name": "User Name",
"address": "test@mail.com"
}
}
},
{
"json": {
"id": "AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvBAAA=",
"name": "Third calendar",
"color": "lightYellow",
"hexColor": "#fde300",
"isDefaultCalendar": false,
"changeKey": "WX+A3vy5K0qqTyPHso1JgAAAi67hIw==",
"canShare": true,
"canViewPrivateItems": true,
"canEdit": true,
"allowedOnlineMeetingProviders": [
"teamsForBusiness"
],
"defaultOnlineMeetingProvider": "teamsForBusiness",
"isTallyingResponses": false,
"isRemovable": true,
"owner": {
"name": "User Name",
"address": "test@mail.com"
}
}
}
]
},
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Microsoft Outlook",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "8f4e7775-0476-4506-a183-1365265b446a",
"id": "1CYHzBXQw1nfPGtB",
"meta": {
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
},
"tags": []
}
@@ -0,0 +1,35 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('Test MicrosoftOutlookV2, calendar => update', () => {
nock('https://graph.microsoft.com/v1.0/me')
.patch(
'/calendars/AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvGAAA=',
{ color: 'lightOrange', isDefaultCalendar: false, name: 'Foo' },
)
.reply(200, {
'@odata.context':
"https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/calendars/$entity",
id: 'AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvGAAA=',
name: 'Foo',
color: 'lightOrange',
hexColor: '#fcab73',
isDefaultCalendar: false,
changeKey: 'WX+A3vy5K0qqTyPHso1JgAABVtwYKA==',
canShare: true,
canViewPrivateItems: true,
canEdit: true,
allowedOnlineMeetingProviders: ['teamsForBusiness'],
defaultOnlineMeetingProvider: 'teamsForBusiness',
isTallyingResponses: false,
isRemovable: true,
owner: {
name: 'User Name',
address: 'test@mail.com',
},
});
new NodeTestHarness().setupTests({
workflowFiles: ['update.workflow.json'],
});
});
@@ -0,0 +1,98 @@
{
"name": "My workflow 21",
"nodes": [
{
"parameters": {},
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
820,
360
]
},
{
"parameters": {
"resource": "calendar",
"operation": "update",
"calendarId": {
"__rl": true,
"value": "AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvGAAA=",
"mode": "list",
"cachedResultName": "Foo Calendar"
},
"updateFields": {
"color": "lightOrange",
"isDefaultCalendar": false,
"name": "Foo"
}
},
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
"name": "Microsoft Outlook",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
1040,
360
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "iXJCki7i5Vz0bdks",
"name": "Microsoft Outlook account 2"
}
}
}
],
"pinData": {
"Microsoft Outlook": [
{
"json": {
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/calendars/$entity",
"id": "AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvGAAA=",
"name": "Foo",
"color": "lightOrange",
"hexColor": "#fcab73",
"isDefaultCalendar": false,
"changeKey": "WX+A3vy5K0qqTyPHso1JgAABVtwYKA==",
"canShare": true,
"canViewPrivateItems": true,
"canEdit": true,
"allowedOnlineMeetingProviders": [
"teamsForBusiness"
],
"defaultOnlineMeetingProvider": "teamsForBusiness",
"isTallyingResponses": false,
"isRemovable": true,
"owner": {
"name": "User Name",
"address": "test@mail.com"
}
}
}
]
},
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Microsoft Outlook",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "f8e68e5f-8c26-4c1f-b11b-8b4e4aeaa61f",
"id": "1CYHzBXQw1nfPGtB",
"meta": {
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
},
"tags": []
}
@@ -0,0 +1,65 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('Test MicrosoftOutlookV2, contact => create', () => {
nock('https://graph.microsoft.com/v1.0/me')
.post('/contacts', {
assistantName: 'Assistant',
birthday: '1991-09-19T21:00:00.000Z',
categories: ['blue', 'green'],
companyName: 'Company',
department: 'IT',
displayName: 'User Name',
givenName: 'User',
surname: 'Name',
title: 'Title',
})
.reply(200, {
'@odata.context':
"https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/contacts/$entity",
'@odata.etag': 'W/"EQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bob"',
id: 'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAABZf4De-LkrSqpPI8eyjUmAAAFXBCQuAAA=',
createdDateTime: '2023-09-04T08:48:39Z',
lastModifiedDateTime: '2023-09-04T08:48:39Z',
changeKey: 'EQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bob',
categories: ['blue', 'green'],
parentFolderId:
'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAAA=',
birthday: '1991-09-19T11:59:00Z',
fileAs: '',
displayName: 'User Name',
givenName: 'User',
initials: null,
middleName: null,
nickName: null,
surname: 'Name',
title: 'Title',
yomiGivenName: null,
yomiSurname: null,
yomiCompanyName: null,
generation: null,
imAddresses: [],
jobTitle: null,
companyName: 'Company',
department: 'IT',
officeLocation: null,
profession: null,
businessHomePage: null,
assistantName: 'Assistant',
manager: null,
homePhones: [],
mobilePhone: null,
businessPhones: [],
spouseName: null,
personalNotes: '',
children: [],
emailAddresses: [],
homeAddress: {},
businessAddress: {},
otherAddress: {},
});
new NodeTestHarness().setupTests({
workflowFiles: ['create.workflow.json'],
});
});
@@ -0,0 +1,121 @@
{
"name": "My workflow 21",
"nodes": [
{
"parameters": {},
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
820,
360
]
},
{
"parameters": {
"resource": "contact",
"operation": "create",
"givenName": "User",
"surname": "Name",
"additionalFields": {
"assistantName": "Assistant",
"birthday": "1991-09-19T21:00:00.000Z",
"categories": "blue, green",
"companyName": "Company",
"department": "IT",
"displayName": "User Name",
"title": "Title"
}
},
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
"name": "Microsoft Outlook",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
1040,
360
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "iXJCki7i5Vz0bdks",
"name": "Microsoft Outlook account 2"
}
}
}
],
"pinData": {
"Microsoft Outlook": [
{
"json": {
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/contacts/$entity",
"@odata.etag": "W/\"EQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bob\"",
"id": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAABZf4De-LkrSqpPI8eyjUmAAAFXBCQuAAA=",
"createdDateTime": "2023-09-04T08:48:39Z",
"lastModifiedDateTime": "2023-09-04T08:48:39Z",
"changeKey": "EQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bob",
"categories": [
"blue",
"green"
],
"parentFolderId": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAAA=",
"birthday": "1991-09-19T11:59:00Z",
"fileAs": "",
"displayName": "User Name",
"givenName": "User",
"initials": null,
"middleName": null,
"nickName": null,
"surname": "Name",
"title": "Title",
"yomiGivenName": null,
"yomiSurname": null,
"yomiCompanyName": null,
"generation": null,
"imAddresses": [],
"jobTitle": null,
"companyName": "Company",
"department": "IT",
"officeLocation": null,
"profession": null,
"businessHomePage": null,
"assistantName": "Assistant",
"manager": null,
"homePhones": [],
"mobilePhone": null,
"businessPhones": [],
"spouseName": null,
"personalNotes": "",
"children": [],
"emailAddresses": [],
"homeAddress": {},
"businessAddress": {},
"otherAddress": {}
}
}
]
},
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Microsoft Outlook",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "51df88ff-b679-43df-9129-d1b26ea6b82d",
"id": "1CYHzBXQw1nfPGtB",
"meta": {
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
},
"tags": []
}
@@ -0,0 +1,75 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('Test MicrosoftOutlookV2, contact => update', () => {
nock('https://graph.microsoft.com/v1.0/me')
.patch(
'/contacts/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAABZf4De-LkrSqpPI8eyjUmAAAFXBCQuAAA=',
{
businessAddress: {
city: 'City',
countryOrRegion: 'Country',
postalCode: '777777',
state: 'State',
street: 'Street',
},
businessPhones: ['999000555777'],
displayName: 'Username',
manager: 'Manager',
},
)
.reply(200, {
'@odata.context':
"https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/contacts/$entity",
'@odata.etag': 'W/"EQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bou"',
id: 'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAABZf4De-LkrSqpPI8eyjUmAAAFXBCQuAAA=',
createdDateTime: '2023-09-04T08:48:39Z',
lastModifiedDateTime: '2023-09-04T09:06:21Z',
changeKey: 'EQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bou',
categories: ['blue', 'green'],
parentFolderId:
'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAAA=',
birthday: '1991-09-19T11:59:00Z',
fileAs: '',
displayName: 'Username',
givenName: 'User',
initials: null,
middleName: null,
nickName: null,
surname: 'Name',
title: 'Title',
yomiGivenName: null,
yomiSurname: null,
yomiCompanyName: null,
generation: null,
imAddresses: [],
jobTitle: null,
companyName: 'Company',
department: 'IT',
officeLocation: null,
profession: null,
businessHomePage: null,
assistantName: 'Assistant',
manager: 'Manager',
homePhones: [],
mobilePhone: '',
businessPhones: ['999000555777'],
spouseName: '',
personalNotes: '',
children: [],
emailAddresses: [],
homeAddress: {},
businessAddress: {
street: 'Street',
city: 'City',
state: 'State',
countryOrRegion: 'Country',
postalCode: '777777',
},
otherAddress: {},
});
new NodeTestHarness().setupTests({
workflowFiles: ['update.workflow.json'],
});
});
@@ -0,0 +1,138 @@
{
"name": "My workflow 21",
"nodes": [
{
"parameters": {},
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
820,
360
]
},
{
"parameters": {
"resource": "contact",
"operation": "update",
"contactId": {
"__rl": true,
"value": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAABZf4De-LkrSqpPI8eyjUmAAAFXBCQuAAA=",
"mode": "list",
"cachedResultName": "User Name"
},
"additionalFields": {
"businessAddress": {
"values": {
"city": "City",
"countryOrRegion": "Country",
"postalCode": "777777",
"state": "State",
"street": "Street"
}
},
"businessPhones": "999000555777",
"displayName": "Username",
"manager": "Manager"
}
},
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
"name": "Microsoft Outlook",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
1040,
360
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "iXJCki7i5Vz0bdks",
"name": "Microsoft Outlook account 2"
}
}
}
],
"pinData": {
"Microsoft Outlook": [
{
"json": {
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/contacts/$entity",
"@odata.etag": "W/\"EQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bou\"",
"id": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAABZf4De-LkrSqpPI8eyjUmAAAFXBCQuAAA=",
"createdDateTime": "2023-09-04T08:48:39Z",
"lastModifiedDateTime": "2023-09-04T09:06:21Z",
"changeKey": "EQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bou",
"categories": [
"blue",
"green"
],
"parentFolderId": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAAA=",
"birthday": "1991-09-19T11:59:00Z",
"fileAs": "",
"displayName": "Username",
"givenName": "User",
"initials": null,
"middleName": null,
"nickName": null,
"surname": "Name",
"title": "Title",
"yomiGivenName": null,
"yomiSurname": null,
"yomiCompanyName": null,
"generation": null,
"imAddresses": [],
"jobTitle": null,
"companyName": "Company",
"department": "IT",
"officeLocation": null,
"profession": null,
"businessHomePage": null,
"assistantName": "Assistant",
"manager": "Manager",
"homePhones": [],
"mobilePhone": "",
"businessPhones": [
"999000555777"
],
"spouseName": "",
"personalNotes": "",
"children": [],
"emailAddresses": [],
"homeAddress": {},
"businessAddress": {
"street": "Street",
"city": "City",
"state": "State",
"countryOrRegion": "Country",
"postalCode": "777777"
},
"otherAddress": {}
}
}
]
},
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Microsoft Outlook",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "842587ce-f153-49ac-8818-d173d4d6aac6",
"id": "1CYHzBXQw1nfPGtB",
"meta": {
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
},
"tags": []
}
@@ -0,0 +1,318 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import { mockDeep } from 'jest-mock-extended';
import type { IExecuteFunctions, INode } from 'n8n-workflow';
import nock from 'nock';
import { Readable } from 'stream';
import { execute } from '../../../../v2/actions/draft/create.operation';
import * as transport from '../../../../v2/transport';
describe('Test MicrosoftOutlookV2, draft => create', () => {
nock('https://graph.microsoft.com/v1.0/me')
.post('/messages', {
bccRecipients: [
{ emailAddress: { address: 'name1@mail.com' } },
{ emailAddress: { address: 'name2@mail.com' } },
],
body: { content: 'draft message', contentType: 'Text' },
categories: [
'd10cd8f9-14ac-460e-a6ec-c40dd1876ea2',
'6844a34e-4d23-4805-9fec-38b7f6e1a780',
'fbf44fcd-7689-43a0-99c8-2c9faf6d825a',
],
importance: 'Normal',
internetMessageHeaders: [{ name: 'x-my-header', value: 'header value' }],
isReadReceiptRequested: true,
replyTo: [{ emailAddress: { address: 'reply@mail.com' } }],
subject: 'New Draft',
toRecipients: [{ emailAddress: { address: 'some@mail.com' } }],
})
.reply(200, {
'@odata.context':
"https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/messages/$entity",
'@odata.etag': 'W/"CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bo2"',
id: 'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAABZf4De-LkrSqpPI8eyjUmAAAFXBDupAAA=',
createdDateTime: '2023-09-04T09:18:35Z',
lastModifiedDateTime: '2023-09-04T09:18:35Z',
changeKey: 'CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bo2',
categories: [
'd10cd8f9-14ac-460e-a6ec-c40dd1876ea2',
'6844a34e-4d23-4805-9fec-38b7f6e1a780',
'fbf44fcd-7689-43a0-99c8-2c9faf6d825a',
],
receivedDateTime: '2023-09-04T09:18:35Z',
sentDateTime: '2023-09-04T09:18:35Z',
hasAttachments: false,
internetMessageId:
'<AM0PR10MB21003DD359041CBE7D64DDB6DDE9A@AM0PR10MB2100.EURPRD10.PROD.OUTLOOK.COM>',
subject: 'New Draft',
bodyPreview: 'draft message',
importance: 'normal',
parentFolderId:
'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAAA=',
conversationId:
'AAQkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAQAKELKTNBg5JJuTnBGaTDyl0=',
conversationIndex: 'AQHZ3xDIoQspM0GDkkm5OcEZpMPKXQ==',
isDeliveryReceiptRequested: false,
isReadReceiptRequested: true,
isRead: true,
isDraft: true,
webLink:
'https://outlook.office365.com/owa/?ItemID=AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De%2FLkrSqpPI8eyjUmAAAAAAAEPAABZf4De%2FLkrSqpPI8eyjUmAAAFXBDupAAA%3D&exvsurl=1&viewmodel=ReadMessageItem',
inferenceClassification: 'focused',
body: {
contentType: 'text',
content: 'draft message',
},
toRecipients: [
{
emailAddress: {
name: 'some@mail.com',
address: 'some@mail.com',
},
},
],
ccRecipients: [],
bccRecipients: [
{
emailAddress: {
name: 'name1@mail.com',
address: 'name1@mail.com',
},
},
{
emailAddress: {
name: 'name2@mail.com',
address: 'name2@mail.com',
},
},
],
replyTo: [
{
emailAddress: {
name: 'reply@mail.com',
address: 'reply@mail.com',
},
},
],
flag: {
flagStatus: 'notFlagged',
},
});
new NodeTestHarness().setupTests({
workflowFiles: ['create.workflow.json'],
});
describe('with attachments', () => {
let mockExecuteFunctions: jest.Mocked<IExecuteFunctions>;
let microsoftApiRequestSpy: jest.SpyInstance;
const mockNode: INode = {
id: 'test-node-id',
name: 'Microsoft Outlook Test',
type: 'n8n-nodes-base.microsoftOutlook',
typeVersion: 2,
position: [0, 0],
parameters: {},
};
beforeEach(() => {
mockExecuteFunctions = mockDeep<IExecuteFunctions>();
microsoftApiRequestSpy = jest.spyOn(transport, 'microsoftApiRequest');
jest.clearAllMocks();
mockExecuteFunctions.getInputData.mockReturnValue([{ json: {} }]);
mockExecuteFunctions.getNode.mockReturnValue(mockNode);
mockExecuteFunctions.continueOnFail.mockReturnValue(false);
(mockExecuteFunctions.helpers.constructExecutionMetaData as jest.Mock).mockImplementation(
(data: any, options: any) => {
return data.map((item: any) => ({
...item,
pairedItem: { item: options?.itemData?.item ?? 0 },
}));
},
);
(mockExecuteFunctions.helpers.returnJsonArray as jest.Mock).mockImplementation(
(data: any) => {
return [{ json: data }];
},
);
});
afterEach(() => {
jest.resetAllMocks();
});
it('should properly await attachments with binary data stream', async () => {
mockExecuteFunctions.getNodeParameter.mockImplementation((paramName: string) => {
const params: Record<string, any> = {
subject: 'Test Draft with Attachment',
bodyContent: 'Test message',
additionalFields: {
attachments: {
attachments: [
{
binaryPropertyName: 'data',
},
],
},
},
};
return params[paramName];
});
const mockBinaryData = {
id: 'binary-data-id-123',
mimeType: 'text/plain',
fileName: 'test-file.txt',
fileExtension: 'txt',
};
(mockExecuteFunctions.helpers.assertBinaryData as jest.Mock).mockReturnValue(mockBinaryData);
const mockStream = Readable.from([Buffer.from('Hello World')]);
(mockExecuteFunctions.helpers.getBinaryStream as jest.Mock).mockResolvedValue(mockStream);
(mockExecuteFunctions.helpers.binaryToBuffer as jest.Mock).mockResolvedValue(
Buffer.from('Hello World'),
);
const mockResponse = {
id: 'draft-id-123',
subject: 'Test Draft with Attachment',
};
microsoftApiRequestSpy.mockResolvedValue(mockResponse);
const result = await execute.call(mockExecuteFunctions, 0, [{ json: {} }]);
expect(microsoftApiRequestSpy).toHaveBeenCalledWith(
'POST',
'/messages',
expect.objectContaining({
subject: 'Test Draft with Attachment',
body: expect.objectContaining({
content: 'Test message',
}),
attachments: [
{
'@odata.type': '#microsoft.graph.fileAttachment',
name: 'test-file.txt',
contentBytes: Buffer.from('Hello World').toString('base64'),
},
],
}),
{},
);
expect(result).toEqual([
{
json: mockResponse,
pairedItem: { item: 0 },
},
]);
});
it('should properly await attachments with direct binary data', async () => {
mockExecuteFunctions.getNodeParameter.mockImplementation((paramName: string) => {
const params: Record<string, any> = {
subject: 'Test Draft',
bodyContent: 'Test',
additionalFields: {
attachments: {
attachments: [
{
binaryPropertyName: 'data',
},
],
},
},
};
return params[paramName];
});
const mockBinaryData = {
data: Buffer.from('Direct data').toString('base64'),
mimeType: 'text/plain',
fileName: 'direct-file.txt',
fileExtension: 'txt',
};
(mockExecuteFunctions.helpers.assertBinaryData as jest.Mock).mockReturnValue(mockBinaryData);
microsoftApiRequestSpy.mockResolvedValue({});
await execute.call(mockExecuteFunctions, 0, [{ json: {} }]);
expect(microsoftApiRequestSpy).toHaveBeenCalledWith(
'POST',
'/messages',
expect.objectContaining({
attachments: [
{
'@odata.type': '#microsoft.graph.fileAttachment',
name: 'direct-file.txt',
contentBytes: mockBinaryData.data,
},
],
}),
{},
);
});
it('should properly await multiple attachments', async () => {
mockExecuteFunctions.getNodeParameter.mockImplementation((paramName: string) => {
const params: Record<string, any> = {
subject: 'Test Draft',
bodyContent: 'Test',
additionalFields: {
attachments: {
attachments: [{ binaryPropertyName: 'file1' }, { binaryPropertyName: 'file2' }],
},
},
};
return params[paramName];
});
(mockExecuteFunctions.helpers.assertBinaryData as jest.Mock)
.mockReturnValueOnce({
id: 'id1',
fileName: 'file1.txt',
})
.mockReturnValueOnce({
data: 'ZmlsZTI=',
fileName: 'file2.txt',
});
const mockStream1 = Readable.from([Buffer.from('file1')]);
(mockExecuteFunctions.helpers.getBinaryStream as jest.Mock).mockResolvedValue(mockStream1);
(mockExecuteFunctions.helpers.binaryToBuffer as jest.Mock).mockResolvedValue(
Buffer.from('file1'),
);
microsoftApiRequestSpy.mockResolvedValue({});
await execute.call(mockExecuteFunctions, 0, [{ json: {} }]);
expect(microsoftApiRequestSpy).toHaveBeenCalledWith(
'POST',
'/messages',
expect.objectContaining({
attachments: expect.arrayContaining([
expect.objectContaining({
name: 'file1.txt',
contentBytes: Buffer.from('file1').toString('base64'),
}),
expect.objectContaining({
name: 'file2.txt',
contentBytes: 'ZmlsZTI=',
}),
]),
}),
{},
);
});
});
});
@@ -0,0 +1,154 @@
{
"name": "My workflow 21",
"nodes": [
{
"parameters": {},
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
820,
360
]
},
{
"parameters": {
"resource": "draft",
"subject": "New Draft",
"bodyContent": "draft message",
"additionalFields": {
"bccRecipients": "name1@mail.com, name2@mail.com",
"categories": [
"d10cd8f9-14ac-460e-a6ec-c40dd1876ea2",
"6844a34e-4d23-4805-9fec-38b7f6e1a780",
"fbf44fcd-7689-43a0-99c8-2c9faf6d825a"
],
"internetMessageHeaders": {
"headers": [
{
"name": "x-my-header",
"value": "header value"
}
]
},
"importance": "Normal",
"bodyContentType": "Text",
"isReadReceiptRequested": true,
"replyTo": "reply@mail.com",
"toRecipients": "some@mail.com"
}
},
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
"name": "Microsoft Outlook",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
1040,
360
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "iXJCki7i5Vz0bdks",
"name": "Microsoft Outlook account 2"
}
}
}
],
"pinData": {
"Microsoft Outlook": [
{
"json": {
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/messages/$entity",
"@odata.etag": "W/\"CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bo2\"",
"id": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAABZf4De-LkrSqpPI8eyjUmAAAFXBDupAAA=",
"createdDateTime": "2023-09-04T09:18:35Z",
"lastModifiedDateTime": "2023-09-04T09:18:35Z",
"changeKey": "CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bo2",
"categories": [
"d10cd8f9-14ac-460e-a6ec-c40dd1876ea2",
"6844a34e-4d23-4805-9fec-38b7f6e1a780",
"fbf44fcd-7689-43a0-99c8-2c9faf6d825a"
],
"receivedDateTime": "2023-09-04T09:18:35Z",
"sentDateTime": "2023-09-04T09:18:35Z",
"hasAttachments": false,
"internetMessageId": "<AM0PR10MB21003DD359041CBE7D64DDB6DDE9A@AM0PR10MB2100.EURPRD10.PROD.OUTLOOK.COM>",
"subject": "New Draft",
"bodyPreview": "draft message",
"importance": "normal",
"parentFolderId": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAAA=",
"conversationId": "AAQkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAQAKELKTNBg5JJuTnBGaTDyl0=",
"conversationIndex": "AQHZ3xDIoQspM0GDkkm5OcEZpMPKXQ==",
"isDeliveryReceiptRequested": false,
"isReadReceiptRequested": true,
"isRead": true,
"isDraft": true,
"webLink": "https://outlook.office365.com/owa/?ItemID=AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De%2FLkrSqpPI8eyjUmAAAAAAAEPAABZf4De%2FLkrSqpPI8eyjUmAAAFXBDupAAA%3D&exvsurl=1&viewmodel=ReadMessageItem",
"inferenceClassification": "focused",
"body": {
"contentType": "text",
"content": "draft message"
},
"toRecipients": [
{
"emailAddress": {
"name": "some@mail.com",
"address": "some@mail.com"
}
}
],
"ccRecipients": [],
"bccRecipients": [
{
"emailAddress": {
"name": "name1@mail.com",
"address": "name1@mail.com"
}
},
{
"emailAddress": {
"name": "name2@mail.com",
"address": "name2@mail.com"
}
}
],
"replyTo": [
{
"emailAddress": {
"name": "reply@mail.com",
"address": "reply@mail.com"
}
}
],
"flag": {
"flagStatus": "notFlagged"
}
}
}
]
},
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Microsoft Outlook",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "7c801e19-1108-4bae-85f1-902820df8c5e",
"id": "1CYHzBXQw1nfPGtB",
"meta": {
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
},
"tags": []
}
@@ -0,0 +1,19 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('Test MicrosoftOutlookV2, draft => send', () => {
nock('https://graph.microsoft.com/v1.0/me')
.post(
'/messages/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAABZf4De-LkrSqpPI8eyjUmAAAFXBDupAAA=/send',
)
.reply(200)
.patch(
'/messages/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAABZf4De-LkrSqpPI8eyjUmAAAFXBDupAAA=',
{ toRecipients: [{ emailAddress: { address: 'michael.k@radency.com' } }] },
)
.reply(200);
new NodeTestHarness().setupTests({
workflowFiles: ['send.workflow.json'],
});
});
@@ -0,0 +1,76 @@
{
"name": "My workflow 21",
"nodes": [
{
"parameters": {},
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
820,
360
]
},
{
"parameters": {
"resource": "draft",
"operation": "send",
"draftId": {
"__rl": true,
"value": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAABZf4De-LkrSqpPI8eyjUmAAAFXBDupAAA=",
"mode": "list",
"cachedResultName": "New Draft",
"cachedResultUrl": "https://outlook.office365.com/owa/?ItemID=AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De%2FLkrSqpPI8eyjUmAAAAAAAEPAABZf4De%2FLkrSqpPI8eyjUmAAAFXBDupAAA%3D&exvsurl=1&viewmodel=ReadMessageItem"
},
"to": "michael.k@radency.com"
},
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
"name": "Microsoft Outlook",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
1040,
360
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "iXJCki7i5Vz0bdks",
"name": "Microsoft Outlook account 2"
}
}
}
],
"pinData": {
"Microsoft Outlook": [
{
"json": {
"success": true
}
}
]
},
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Microsoft Outlook",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "4bbe3403-3da7-4e6e-8341-7da5e8433330",
"id": "1CYHzBXQw1nfPGtB",
"meta": {
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
},
"tags": []
}
@@ -0,0 +1,112 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('Test MicrosoftOutlookV2, contact => event', () => {
nock('https://graph.microsoft.com/v1.0/me')
.post(
'/calendars/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAAAJ9-JDAAA=/events',
{
body: { content: 'event description', contentType: 'html' },
bodyPreview: 'preview',
categories: ['Yellow category', 'Orange category'],
end: { dateTime: '2023-09-06T07:56:47.000Z', timeZone: 'UTC' },
hideAttendees: true,
importance: 'normal',
isAllDay: false,
isCancelled: false,
isDraft: false,
isOnlineMeeting: true,
sensitivity: 'personal',
showAs: 'busy',
start: { dateTime: '2023-09-05T07:26:47.000Z', timeZone: 'UTC' },
subject: 'New Event',
type: 'occurrence',
},
)
.reply(200, {
'@odata.context':
"https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/calendars('AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAAAJ9-JDAAA%3D')/events/$entity",
'@odata.etag': 'W/"WX+A3vy5K0qqTyPHso1JgAABVtwgEQ=="',
id: 'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAENAABZf4De-LkrSqpPI8eyjUmAAAFXBFUSAAA=',
createdDateTime: '2023-09-04T10:12:47.1985121Z',
lastModifiedDateTime: '2023-09-04T10:12:48.2173253Z',
changeKey: 'WX+A3vy5K0qqTyPHso1JgAABVtwgEQ==',
categories: ['Yellow category', 'Orange category'],
transactionId: null,
originalStartTimeZone: 'UTC',
originalEndTimeZone: 'UTC',
iCalUId:
'040000008200E00074C5B7101A82E0080000000062DD545A18DFD90100000000000000001000000004C50947C7B42140B29018ABAB42C965',
reminderMinutesBeforeStart: 15,
isReminderOn: true,
hasAttachments: false,
subject: 'New Event',
bodyPreview:
'event description\r\n________________________________________________________________________________\r\nMicrosoft Teams meeting\r\nJoin on your computer, mobile app or room device\r\nClick here to join the meeting\r\nMeeting ID: 355 132 640 047\r\nPasscode: xgUo7v',
importance: 'normal',
sensitivity: 'personal',
isAllDay: false,
isCancelled: false,
isOrganizer: true,
responseRequested: true,
seriesMasterId: null,
showAs: 'busy',
type: 'singleInstance',
webLink:
'https://outlook.office365.com/owa/?itemid=AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De%2FLkrSqpPI8eyjUmAAAAAAAENAABZf4De%2FLkrSqpPI8eyjUmAAAFXBFUSAAA%3D&exvsurl=1&path=/calendar/item',
onlineMeetingUrl: null,
isOnlineMeeting: true,
onlineMeetingProvider: 'teamsForBusiness',
allowNewTimeProposals: true,
occurrenceId: null,
isDraft: false,
hideAttendees: true,
responseStatus: {
response: 'organizer',
time: '0001-01-01T00:00:00Z',
},
body: {
contentType: 'html',
content:
'<html>\r\n<head>\r\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r\n</head>\r\n<body>\r\nevent description<br>\r\n<div style="width:100%"><span style="white-space:nowrap; color:#5F5F5F; opacity:.36">________________________________________________________________________________</span>\r\n</div>\r\n<div class="me-email-text" lang="en-US" style="color:#252424; font-family:\'Segoe UI\',\'Helvetica Neue\',Helvetica,Arial,sans-serif">\r\n<div style="margin-top:24px; margin-bottom:20px"><span style="font-size:24px; color:#252424">Microsoft Teams meeting</span>\r\n</div>\r\n<div style="margin-bottom:20px">\r\n<div style="margin-top:0px; margin-bottom:0px; font-weight:bold"><span style="font-size:14px; color:#252424">Join on your computer, mobile app or room device</span>\r\n</div>\r\n<a href="https://teams.microsoft.com/l/meetup-join/19%3ameeting_MDZmMzZmYzYtMDc4Yi00NTA2LWE3MTMtZDc5ZDI1M2JmY2M3%40thread.v2/0?context=%7b%22Tid%22%3a%2223786ca6-7ff2-4672-87d0-5c649ee0a337%22%2c%22Oid%22%3a%22b834447b-6848-4af9-8390-d2259ce46b74%22%7d" class="me-email-headline" style="font-size:14px; font-family:\'Segoe UI Semibold\',\'Segoe UI\',\'Helvetica Neue\',Helvetica,Arial,sans-serif; text-decoration:underline; color:#6264a7">Click\r\n here to join the meeting</a> </div>\r\n<div style="margin-bottom:20px; margin-top:20px">\r\n<div style="margin-bottom:4px"><span data-tid="meeting-code" style="font-size:14px; color:#252424">Meeting ID:\r\n<span style="font-size:16px; color:#252424">355 132 640 047</span> </span><br>\r\n<span style="font-size:14px; color:#252424">Passcode: </span><span style="font-size:16px; color:#252424">xgUo7v\r\n</span>\r\n<div style="font-size:14px"><a href="https://www.microsoft.com/en-us/microsoft-teams/download-app" class="me-email-link" style="font-size:14px; text-decoration:underline; color:#6264a7; font-family:\'Segoe UI\',\'Helvetica Neue\',Helvetica,Arial,sans-serif">Download\r\n Teams</a> | <a href="https://www.microsoft.com/microsoft-teams/join-a-meeting" class="me-email-link" style="font-size:14px; text-decoration:underline; color:#6264a7; font-family:\'Segoe UI\',\'Helvetica Neue\',Helvetica,Arial,sans-serif">\r\nJoin on the web</a></div>\r\n</div>\r\n</div>\r\n<div style="margin-bottom:24px; margin-top:20px"><a href="https://aka.ms/JoinTeamsMeeting" class="me-email-link" style="font-size:14px; text-decoration:underline; color:#6264a7; font-family:\'Segoe UI\',\'Helvetica Neue\',Helvetica,Arial,sans-serif">Learn More</a>\r\n | <a href="https://teams.microsoft.com/meetingOptions/?organizerId=b834447b-6848-4af9-8390-d2259ce46b74&amp;tenantId=23786ca6-7ff2-4672-87d0-5c649ee0a337&amp;threadId=19_meeting_MDZmMzZmYzYtMDc4Yi00NTA2LWE3MTMtZDc5ZDI1M2JmY2M3@thread.v2&amp;messageId=0&amp;language=en-US" class="me-email-link" style="font-size:14px; text-decoration:underline; color:#6264a7; font-family:\'Segoe UI\',\'Helvetica Neue\',Helvetica,Arial,sans-serif">\r\nMeeting options</a> </div>\r\n</div>\r\n<div style="font-size:14px; margin-bottom:4px; font-family:\'Segoe UI\',\'Helvetica Neue\',Helvetica,Arial,sans-serif">\r\n</div>\r\n<div style="font-size:12px"></div>\r\n<div></div>\r\n<div style="width:100%"><span style="white-space:nowrap; color:#5F5F5F; opacity:.36">________________________________________________________________________________</span>\r\n</div>\r\n</body>\r\n</html>\r\n',
},
start: {
dateTime: '2023-09-05T07:26:47.0000000',
timeZone: 'UTC',
},
end: {
dateTime: '2023-09-06T07:56:47.0000000',
timeZone: 'UTC',
},
location: {
displayName: 'Microsoft Teams Meeting',
locationType: 'default',
uniqueId: 'Microsoft Teams Meeting',
uniqueIdType: 'private',
},
locations: [
{
displayName: 'Microsoft Teams Meeting',
locationType: 'default',
uniqueId: 'Microsoft Teams Meeting',
uniqueIdType: 'private',
},
],
recurrence: null,
attendees: [],
organizer: {
emailAddress: {
name: 'Michael Kret',
address: 'MichaelDevSandbox@5w1hb7.onmicrosoft.com',
},
},
onlineMeeting: {
joinUrl:
'https://teams.microsoft.com/l/meetup-join/19%3ameeting_MDZmMzZmYzYtMDc4Yi00NTA2LWE3MTMtZDc5ZDI1M2JmY2M3%40thread.v2/0?context=%7b%22Tid%22%3a%2223786ca6-7ff2-4672-87d0-5c649ee0a337%22%2c%22Oid%22%3a%22b834447b-6848-4af9-8390-d2259ce46b74%22%7d',
},
});
new NodeTestHarness().setupTests({
workflowFiles: ['create.workflow.json'],
});
});
@@ -0,0 +1,170 @@
{
"name": "My workflow 21",
"nodes": [
{
"parameters": {},
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
820,
360
]
},
{
"parameters": {
"resource": "event",
"operation": "create",
"calendarId": {
"__rl": true,
"value": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAAAJ9-JDAAA=",
"mode": "list",
"cachedResultName": "Calendar"
},
"subject": "New Event",
"startDateTime": "2023-09-05T07:26:47.000Z",
"endDateTime": "2023-09-06T07:56:47.000Z",
"additionalFields": {
"categories": [
"Yellow category",
"Orange category"
],
"body": "event description",
"bodyPreview": "preview",
"hideAttendees": true,
"importance": "normal",
"isAllDay": false,
"isCancelled": false,
"isDraft": false,
"isOnlineMeeting": true,
"sensitivity": "personal",
"showAs": "busy",
"type": "occurrence"
}
},
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
"name": "Microsoft Outlook",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
1040,
360
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "iXJCki7i5Vz0bdks",
"name": "Microsoft Outlook account 2"
}
}
}
],
"pinData": {
"Microsoft Outlook": [
{
"json": {
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/calendars('AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAAAJ9-JDAAA%3D')/events/$entity",
"@odata.etag": "W/\"WX+A3vy5K0qqTyPHso1JgAABVtwgEQ==\"",
"id": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAENAABZf4De-LkrSqpPI8eyjUmAAAFXBFUSAAA=",
"createdDateTime": "2023-09-04T10:12:47.1985121Z",
"lastModifiedDateTime": "2023-09-04T10:12:48.2173253Z",
"changeKey": "WX+A3vy5K0qqTyPHso1JgAABVtwgEQ==",
"categories": [
"Yellow category",
"Orange category"
],
"transactionId": null,
"originalStartTimeZone": "UTC",
"originalEndTimeZone": "UTC",
"iCalUId": "040000008200E00074C5B7101A82E0080000000062DD545A18DFD90100000000000000001000000004C50947C7B42140B29018ABAB42C965",
"reminderMinutesBeforeStart": 15,
"isReminderOn": true,
"hasAttachments": false,
"subject": "New Event",
"bodyPreview": "event description\r\n________________________________________________________________________________\r\nMicrosoft Teams meeting\r\nJoin on your computer, mobile app or room device\r\nClick here to join the meeting\r\nMeeting ID: 355 132 640 047\r\nPasscode: xgUo7v",
"importance": "normal",
"sensitivity": "personal",
"isAllDay": false,
"isCancelled": false,
"isOrganizer": true,
"responseRequested": true,
"seriesMasterId": null,
"showAs": "busy",
"type": "singleInstance",
"webLink": "https://outlook.office365.com/owa/?itemid=AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De%2FLkrSqpPI8eyjUmAAAAAAAENAABZf4De%2FLkrSqpPI8eyjUmAAAFXBFUSAAA%3D&exvsurl=1&path=/calendar/item",
"onlineMeetingUrl": null,
"isOnlineMeeting": true,
"onlineMeetingProvider": "teamsForBusiness",
"allowNewTimeProposals": true,
"occurrenceId": null,
"isDraft": false,
"hideAttendees": true,
"responseStatus": {
"response": "organizer",
"time": "0001-01-01T00:00:00Z"
},
"body": {
"contentType": "html",
"content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n</head>\r\n<body>\r\nevent description<br>\r\n<div style=\"width:100%\"><span style=\"white-space:nowrap; color:#5F5F5F; opacity:.36\">________________________________________________________________________________</span>\r\n</div>\r\n<div class=\"me-email-text\" lang=\"en-US\" style=\"color:#252424; font-family:'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif\">\r\n<div style=\"margin-top:24px; margin-bottom:20px\"><span style=\"font-size:24px; color:#252424\">Microsoft Teams meeting</span>\r\n</div>\r\n<div style=\"margin-bottom:20px\">\r\n<div style=\"margin-top:0px; margin-bottom:0px; font-weight:bold\"><span style=\"font-size:14px; color:#252424\">Join on your computer, mobile app or room device</span>\r\n</div>\r\n<a href=\"https://teams.microsoft.com/l/meetup-join/19%3ameeting_MDZmMzZmYzYtMDc4Yi00NTA2LWE3MTMtZDc5ZDI1M2JmY2M3%40thread.v2/0?context=%7b%22Tid%22%3a%2223786ca6-7ff2-4672-87d0-5c649ee0a337%22%2c%22Oid%22%3a%22b834447b-6848-4af9-8390-d2259ce46b74%22%7d\" class=\"me-email-headline\" style=\"font-size:14px; font-family:'Segoe UI Semibold','Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; text-decoration:underline; color:#6264a7\">Click\r\n here to join the meeting</a> </div>\r\n<div style=\"margin-bottom:20px; margin-top:20px\">\r\n<div style=\"margin-bottom:4px\"><span data-tid=\"meeting-code\" style=\"font-size:14px; color:#252424\">Meeting ID:\r\n<span style=\"font-size:16px; color:#252424\">355 132 640 047</span> </span><br>\r\n<span style=\"font-size:14px; color:#252424\">Passcode: </span><span style=\"font-size:16px; color:#252424\">xgUo7v\r\n</span>\r\n<div style=\"font-size:14px\"><a href=\"https://www.microsoft.com/en-us/microsoft-teams/download-app\" class=\"me-email-link\" style=\"font-size:14px; text-decoration:underline; color:#6264a7; font-family:'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif\">Download\r\n Teams</a> | <a href=\"https://www.microsoft.com/microsoft-teams/join-a-meeting\" class=\"me-email-link\" style=\"font-size:14px; text-decoration:underline; color:#6264a7; font-family:'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif\">\r\nJoin on the web</a></div>\r\n</div>\r\n</div>\r\n<div style=\"margin-bottom:24px; margin-top:20px\"><a href=\"https://aka.ms/JoinTeamsMeeting\" class=\"me-email-link\" style=\"font-size:14px; text-decoration:underline; color:#6264a7; font-family:'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif\">Learn More</a>\r\n | <a href=\"https://teams.microsoft.com/meetingOptions/?organizerId=b834447b-6848-4af9-8390-d2259ce46b74&amp;tenantId=23786ca6-7ff2-4672-87d0-5c649ee0a337&amp;threadId=19_meeting_MDZmMzZmYzYtMDc4Yi00NTA2LWE3MTMtZDc5ZDI1M2JmY2M3@thread.v2&amp;messageId=0&amp;language=en-US\" class=\"me-email-link\" style=\"font-size:14px; text-decoration:underline; color:#6264a7; font-family:'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif\">\r\nMeeting options</a> </div>\r\n</div>\r\n<div style=\"font-size:14px; margin-bottom:4px; font-family:'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif\">\r\n</div>\r\n<div style=\"font-size:12px\"></div>\r\n<div></div>\r\n<div style=\"width:100%\"><span style=\"white-space:nowrap; color:#5F5F5F; opacity:.36\">________________________________________________________________________________</span>\r\n</div>\r\n</body>\r\n</html>\r\n"
},
"start": {
"dateTime": "2023-09-05T07:26:47.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2023-09-06T07:56:47.0000000",
"timeZone": "UTC"
},
"location": {
"displayName": "Microsoft Teams Meeting",
"locationType": "default",
"uniqueId": "Microsoft Teams Meeting",
"uniqueIdType": "private"
},
"locations": [
{
"displayName": "Microsoft Teams Meeting",
"locationType": "default",
"uniqueId": "Microsoft Teams Meeting",
"uniqueIdType": "private"
}
],
"recurrence": null,
"attendees": [],
"organizer": {
"emailAddress": {
"name": "Michael Kret",
"address": "MichaelDevSandbox@5w1hb7.onmicrosoft.com"
}
},
"onlineMeeting": {
"joinUrl": "https://teams.microsoft.com/l/meetup-join/19%3ameeting_MDZmMzZmYzYtMDc4Yi00NTA2LWE3MTMtZDc5ZDI1M2JmY2M3%40thread.v2/0?context=%7b%22Tid%22%3a%2223786ca6-7ff2-4672-87d0-5c649ee0a337%22%2c%22Oid%22%3a%22b834447b-6848-4af9-8390-d2259ce46b74%22%7d"
}
}
}
]
},
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Microsoft Outlook",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "dceb08aa-5897-44d1-afbc-748d1e8a2626",
"id": "1CYHzBXQw1nfPGtB",
"meta": {
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
},
"tags": []
}
@@ -0,0 +1,27 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('Test MicrosoftOutlookV2, contact => folder', () => {
nock('https://graph.microsoft.com')
.post(
'/v1.0/me/mailFolders/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEGAAA=/childFolders',
{ displayName: 'Folder 42' },
)
.reply(200, {
'@odata.context':
"https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/mailFolders('AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEGAAA%3D')/childFolders/$entity",
id: 'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEHAAA=',
displayName: 'Folder 42',
parentFolderId:
'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEGAAA=',
childFolderCount: 0,
unreadItemCount: 0,
totalItemCount: 0,
sizeInBytes: 0,
isHidden: false,
});
new NodeTestHarness().setupTests({
workflowFiles: ['create.workflow.json'],
});
});
@@ -0,0 +1,85 @@
{
"name": "My workflow 21",
"nodes": [
{
"parameters": {},
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
820,
360
]
},
{
"parameters": {
"resource": "folder",
"displayName": "Folder 42",
"options": {
"folderId": {
"__rl": true,
"value": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEGAAA=",
"mode": "list",
"cachedResultName": "New folder",
"cachedResultUrl": "https://outlook.office365.com/mail/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De%2FLkrSqpPI8eyjUmAAAFXBAEGAAA%3D"
}
}
},
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
"name": "Microsoft Outlook",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
1040,
360
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "iXJCki7i5Vz0bdks",
"name": "Microsoft Outlook account 2"
}
}
}
],
"pinData": {
"Microsoft Outlook": [
{
"json": {
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/mailFolders('AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEGAAA%3D')/childFolders/$entity",
"id": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEHAAA=",
"displayName": "Folder 42",
"parentFolderId": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEGAAA=",
"childFolderCount": 0,
"unreadItemCount": 0,
"totalItemCount": 0,
"sizeInBytes": 0,
"isHidden": false
}
}
]
},
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Microsoft Outlook",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "6f7a33a8-d48a-4ae2-ab1c-bbe0a83d376f",
"id": "1CYHzBXQw1nfPGtB",
"meta": {
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
},
"tags": []
}
@@ -0,0 +1,23 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('Test MicrosoftOutlookV2, folderMessage => getAll', () => {
nock('https://graph.microsoft.com/v1.0/me')
.get(
'/mailFolders/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEHAAA=/messages?%24select=bodyPreview%2Csubject&%24top=100',
)
.reply(200, {
value: [
{
'@odata.etag': 'W/"CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3CAj"',
id: 'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAFXBAEHAABZf4De-LkrSqpPI8eyjUmAAAFXBGDUAAA=',
subject: 'XXXX',
bodyPreview: 'test',
},
],
});
new NodeTestHarness().setupTests({
workflowFiles: ['getAll.workflow.json'],
});
});
@@ -0,0 +1,84 @@
{
"name": "My workflow 21",
"nodes": [
{
"parameters": {},
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
820,
360
]
},
{
"parameters": {
"resource": "folderMessage",
"folderId": {
"__rl": true,
"value": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEHAAA=",
"mode": "list",
"cachedResultName": "Folder 42",
"cachedResultUrl": "https://outlook.office365.com/mail/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De%2FLkrSqpPI8eyjUmAAAFXBAEHAAA%3D"
},
"returnAll": true,
"output": "fields",
"fields": [
"bodyPreview",
"subject"
],
"options": {}
},
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
"name": "Microsoft Outlook",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
1040,
360
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "iXJCki7i5Vz0bdks",
"name": "Microsoft Outlook account 2"
}
}
}
],
"pinData": {
"Microsoft Outlook": [
{
"json": {
"@odata.etag": "W/\"CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3CAj\"",
"id": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAFXBAEHAABZf4De-LkrSqpPI8eyjUmAAAFXBGDUAAA=",
"subject": "XXXX",
"bodyPreview": "test"
}
}
]
},
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Microsoft Outlook",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "63e4c95c-2998-4f3a-bcbc-1dfea015fecb",
"id": "1CYHzBXQw1nfPGtB",
"meta": {
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
},
"tags": []
}
@@ -0,0 +1,59 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('Test MicrosoftOutlookV2, message => get', () => {
const credentials = {
microsoftOutlookOAuth2Api: {
accessToken: 'test-access-token',
refreshToken: 'test-refresh-token',
},
};
beforeAll(() => {
const messageId =
'AAMkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgBGAAAAAAA_iGOFSpJvRJ8V0rRW_J9FBwBZf4De_LkrSqpPI8eyjUmAAAACEDdwAABZf4De_LkrSqpPI8eyjUmAAAFSpKecAAA=';
nock('https://graph.microsoft.com')
.get(`/v1.0/me/messages/${messageId}`)
.query({
$select:
'id,conversationId,subject,bodyPreview,from,toRecipients,categories,hasAttachments',
})
.reply(200, {
'@odata.context': 'https://graph.microsoft.com/v1.0/$metadata#users/messages/$entity',
'@odata.etag': 'W/"CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFSpKec"',
id: messageId,
conversationId:
'AAQkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgAQALc9G-OGBp9Hshu8JZGiSFs=',
subject: 'Test Email Subject',
bodyPreview: 'This is a test email body preview for the get operation',
from: {
emailAddress: {
name: 'John Doe',
address: 'john.doe@example.com',
},
},
toRecipients: [
{
emailAddress: {
name: 'Jane Smith',
address: 'jane.smith@example.com',
},
},
{
emailAddress: {
name: 'Bob Wilson',
address: 'bob.wilson@example.com',
},
},
],
categories: ['Blue category', 'Important'],
hasAttachments: true,
});
});
new NodeTestHarness().setupTests({
credentials,
workflowFiles: ['get.workflow.json'],
});
});
@@ -0,0 +1,75 @@
{
"name": "Microsoft Outlook Message Get Test",
"nodes": [
{
"parameters": {},
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [820, 360]
},
{
"parameters": {
"resource": "message",
"operation": "get",
"messageId": {
"__rl": true,
"value": "AAMkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgBGAAAAAAA_iGOFSpJvRJ8V0rRW_J9FBwBZf4De_LkrSqpPI8eyjUmAAAACEDdwAABZf4De_LkrSqpPI8eyjUmAAAFSpKecAAA=",
"mode": "id"
},
"output": "simple"
},
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
"name": "Microsoft Outlook",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [1040, 360],
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "iXJCki7i5Vz0bdks",
"name": "Microsoft Outlook OAuth2 Test"
}
}
}
],
"pinData": {
"Microsoft Outlook": [
{
"json": {
"id": "AAMkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgBGAAAAAAA_iGOFSpJvRJ8V0rRW_J9FBwBZf4De_LkrSqpPI8eyjUmAAAACEDdwAABZf4De_LkrSqpPI8eyjUmAAAFSpKecAAA=",
"conversationId": "AAQkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgAQALc9G-OGBp9Hshu8JZGiSFs=",
"subject": "Test Email Subject",
"bodyPreview": "This is a test email body preview for the get operation",
"from": "john.doe@example.com",
"to": ["jane.smith@example.com", "bob.wilson@example.com"],
"categories": ["Blue category", "Important"],
"hasAttachments": true
}
}
]
},
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Microsoft Outlook",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "fed8ec2e-8663-4dfc-8234-33eb83257260",
"id": "1CYHzBXQw1nfPGtB",
"meta": {
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
},
"tags": []
}
@@ -0,0 +1,79 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('Test MicrosoftOutlookV2, message => getAll', () => {
const credentials = {
microsoftOutlookOAuth2Api: {
accessToken: 'test-access-token',
refreshToken: 'test-refresh-token',
},
};
beforeAll(() => {
nock('https://graph.microsoft.com')
.get('/v1.0/me/messages')
.query({
$select:
'id,conversationId,subject,bodyPreview,from,toRecipients,categories,hasAttachments',
$top: 50,
})
.reply(200, {
'@odata.context': 'https://graph.microsoft.com/v1.0/$metadata#users/messages',
value: [
{
'@odata.etag': 'W/"CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFSpKec"',
id: 'AAMkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgBGAAAAAAA_iGOFSpJvRJ8V0rRW_J9FBwBZf4De_LkrSqpPI8eyjUmAAAACEDdwAABZf4De_LkrSqpPI8eyjUmAAAFSpKecAAA=',
conversationId:
'AAQkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgAQALc9G-OGBp9Hshu8JZGiSFs=',
subject: 'Test Email 1',
bodyPreview: 'This is the first test email body preview',
from: {
emailAddress: {
name: 'John Doe',
address: 'john.doe@example.com',
},
},
toRecipients: [
{
emailAddress: {
name: 'Jane Smith',
address: 'jane.smith@example.com',
},
},
],
categories: ['Blue category'],
hasAttachments: false,
},
{
'@odata.etag': 'W/"CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFSpKed"',
id: 'AAMkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgBGAAAAAAA_iGOFSpJvRJ8V0rRW_J9FBwBZf4De_LkrSqpPI8eyjUmAAAACEDdwAABZf4De_LkrSqpPI8eyjUmAAAFSpKedAAA=',
conversationId:
'AAQkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgAQALc9G-OGBp9Hshu8JZGiSFt=',
subject: 'Test Email 2',
bodyPreview: 'This is the second test email body preview',
from: {
emailAddress: {
name: 'Alice Johnson',
address: 'alice.johnson@example.com',
},
},
toRecipients: [
{
emailAddress: {
name: 'Bob Wilson',
address: 'bob.wilson@example.com',
},
},
],
categories: ['Red category'],
hasAttachments: true,
},
],
});
});
new NodeTestHarness().setupTests({
credentials,
workflowFiles: ['getAll.workflow.json'],
});
});
@@ -0,0 +1,84 @@
{
"name": "Microsoft Outlook Message Get All Test",
"nodes": [
{
"parameters": {},
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [820, 360]
},
{
"parameters": {
"resource": "message",
"operation": "getAll",
"returnAll": false,
"limit": 50,
"output": "simple"
},
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
"name": "Microsoft Outlook",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [1040, 360],
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "iXJCki7i5Vz0bdks",
"name": "Microsoft Outlook OAuth2 Test"
}
}
}
],
"pinData": {
"Microsoft Outlook": [
{
"json": {
"id": "AAMkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgBGAAAAAAA_iGOFSpJvRJ8V0rRW_J9FBwBZf4De_LkrSqpPI8eyjUmAAAACEDdwAABZf4De_LkrSqpPI8eyjUmAAAFSpKecAAA=",
"conversationId": "AAQkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgAQALc9G-OGBp9Hshu8JZGiSFs=",
"subject": "Test Email 1",
"bodyPreview": "This is the first test email body preview",
"from": "john.doe@example.com",
"to": ["jane.smith@example.com"],
"categories": ["Blue category"],
"hasAttachments": false
}
},
{
"json": {
"id": "AAMkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgBGAAAAAAA_iGOFSpJvRJ8V0rRW_J9FBwBZf4De_LkrSqpPI8eyjUmAAAACEDdwAABZf4De_LkrSqpPI8eyjUmAAAFSpKedAAA=",
"conversationId": "AAQkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgAQALc9G-OGBp9Hshu8JZGiSFt=",
"subject": "Test Email 2",
"bodyPreview": "This is the second test email body preview",
"from": "alice.johnson@example.com",
"to": ["bob.wilson@example.com"],
"categories": ["Red category"],
"hasAttachments": true
}
}
]
},
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Microsoft Outlook",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "fed8ec2e-8663-4dfc-8234-33eb83257260",
"id": "1CYHzBXQw1nfPGtB",
"meta": {
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
},
"tags": []
}
@@ -0,0 +1,18 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('Test MicrosoftOutlookV2, message => move', () => {
nock('https://graph.microsoft.com/v1.0/me')
.post(
'/messages/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEJAABZf4De-LkrSqpPI8eyjUmAAAFXBEVwAAA=/move',
{
destinationId:
'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEHAAA=',
},
)
.reply(200);
new NodeTestHarness().setupTests({
workflowFiles: ['move.workflow.json'],
});
});
@@ -0,0 +1,81 @@
{
"name": "My workflow 21",
"nodes": [
{
"parameters": {},
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
820,
360
]
},
{
"parameters": {
"operation": "move",
"messageId": {
"__rl": true,
"value": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEJAABZf4De-LkrSqpPI8eyjUmAAAFXBEVwAAA=",
"mode": "list",
"cachedResultName": "Hello",
"cachedResultUrl": "https://outlook.office365.com/owa/?ItemID=AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De%2FLkrSqpPI8eyjUmAAAAAAAEJAABZf4De%2FLkrSqpPI8eyjUmAAAFXBEVwAAA%3D&exvsurl=1&viewmodel=ReadMessageItem"
},
"folderId": {
"__rl": true,
"value": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEHAAA=",
"mode": "list",
"cachedResultName": "Folder 42",
"cachedResultUrl": "https://outlook.office365.com/mail/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De%2FLkrSqpPI8eyjUmAAAFXBAEHAAA%3D"
}
},
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
"name": "Microsoft Outlook",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
1040,
360
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "iXJCki7i5Vz0bdks",
"name": "Microsoft Outlook account 2"
}
}
}
],
"pinData": {
"Microsoft Outlook": [
{
"json": {
"success": true
}
}
]
},
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Microsoft Outlook",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "1434b547-7141-4650-8dce-333dda26e092",
"id": "1CYHzBXQw1nfPGtB",
"meta": {
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
},
"tags": []
}
@@ -0,0 +1,85 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('Test MicrosoftOutlookV2, message => reply', () => {
nock('https://graph.microsoft.com/v1.0/me')
.post(
'/messages/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEJAABZf4De-LkrSqpPI8eyjUmAAAFXBEVwAAA=/createReply',
{
message: {
body: { content: 'Reply message', contentType: 'html' },
importance: 'High',
subject: 'Reply Subject',
},
},
)
.reply(200, {
'@odata.context':
"https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/messages/$entity",
'@odata.etag': 'W/"CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3CX+"',
id: 'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAABZf4De-LkrSqpPI8eyjUmAAAFXBDurAAA=',
createdDateTime: '2023-09-04T12:29:59Z',
lastModifiedDateTime: '2023-09-04T12:29:59Z',
changeKey: 'CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3CX+',
categories: [],
receivedDateTime: '2023-09-04T12:29:59Z',
sentDateTime: '2023-09-04T12:29:59Z',
hasAttachments: false,
internetMessageId:
'<AM0PR10MB2100903A148F1623165004E3DDE9A@AM0PR10MB2100.EURPRD10.PROD.OUTLOOK.COM>',
subject: 'Reply Subject',
bodyPreview: 'Reply message',
importance: 'high',
parentFolderId:
'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAAA=',
conversationId:
'AAQkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAQAKwkQLinj69KtoFOxMG2lVY=',
conversationIndex: 'AQHZ3yq3rCRAuKePr0q2gU7EwbaVVrAKmLQ4',
isDeliveryReceiptRequested: false,
isReadReceiptRequested: false,
isRead: true,
isDraft: true,
webLink:
'https://outlook.office365.com/owa/?ItemID=AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De%2FLkrSqpPI8eyjUmAAAAAAAEPAABZf4De%2FLkrSqpPI8eyjUmAAAFXBDurAAA%3D&exvsurl=1&viewmodel=ReadMessageItem',
inferenceClassification: 'focused',
body: {
contentType: 'html',
content:
'<html><head>\r\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>Reply message </body></html>',
},
sender: {
emailAddress: {
name: 'Michael Kret',
address: 'MichaelDevSandbox@5w1hb7.onmicrosoft.com',
},
},
from: {
emailAddress: {
name: 'Michael Kret',
address: 'MichaelDevSandbox@5w1hb7.onmicrosoft.com',
},
},
toRecipients: [
{
emailAddress: {
name: 'reply@mail.com',
address: 'reply@mail.com',
},
},
],
ccRecipients: [],
bccRecipients: [],
replyTo: [],
flag: {
flagStatus: 'notFlagged',
},
})
.post(
'/messages/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAABZf4De-LkrSqpPI8eyjUmAAAFXBDurAAA=/send',
)
.reply(200);
new NodeTestHarness().setupTests({
workflowFiles: ['reply.workflow.json'],
});
});
@@ -0,0 +1,134 @@
{
"name": "My workflow 21",
"nodes": [
{
"parameters": {},
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
820,
360
]
},
{
"parameters": {
"operation": "reply",
"messageId": {
"__rl": true,
"value": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEJAABZf4De-LkrSqpPI8eyjUmAAAFXBEVwAAA=",
"mode": "list",
"cachedResultName": "Hello",
"cachedResultUrl": "https://outlook.office365.com/owa/?ItemID=AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De%2FLkrSqpPI8eyjUmAAAAAAAEJAABZf4De%2FLkrSqpPI8eyjUmAAAFXBEVwAAA%3D&exvsurl=1&viewmodel=ReadMessageItem"
},
"replyToSenderOnly": true,
"message": "Reply message",
"additionalFields": {
"importance": "High",
"bodyContentType": "html",
"subject": "Reply Subject"
},
"options": {}
},
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
"name": "Microsoft Outlook",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
1040,
360
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "iXJCki7i5Vz0bdks",
"name": "Microsoft Outlook account 2"
}
}
}
],
"pinData": {
"Microsoft Outlook": [
{
"json": {
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/messages/$entity",
"@odata.etag": "W/\"CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3CX+\"",
"id": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAABZf4De-LkrSqpPI8eyjUmAAAFXBDurAAA=",
"createdDateTime": "2023-09-04T12:29:59Z",
"lastModifiedDateTime": "2023-09-04T12:29:59Z",
"changeKey": "CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3CX+",
"categories": [],
"receivedDateTime": "2023-09-04T12:29:59Z",
"sentDateTime": "2023-09-04T12:29:59Z",
"hasAttachments": false,
"internetMessageId": "<AM0PR10MB2100903A148F1623165004E3DDE9A@AM0PR10MB2100.EURPRD10.PROD.OUTLOOK.COM>",
"subject": "Reply Subject",
"bodyPreview": "Reply message",
"importance": "high",
"parentFolderId": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAAA=",
"conversationId": "AAQkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAQAKwkQLinj69KtoFOxMG2lVY=",
"conversationIndex": "AQHZ3yq3rCRAuKePr0q2gU7EwbaVVrAKmLQ4",
"isDeliveryReceiptRequested": false,
"isReadReceiptRequested": false,
"isRead": true,
"isDraft": true,
"webLink": "https://outlook.office365.com/owa/?ItemID=AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De%2FLkrSqpPI8eyjUmAAAAAAAEPAABZf4De%2FLkrSqpPI8eyjUmAAAFXBDurAAA%3D&exvsurl=1&viewmodel=ReadMessageItem",
"inferenceClassification": "focused",
"body": {
"contentType": "html",
"content": "<html><head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"></head><body>Reply message </body></html>"
},
"sender": {
"emailAddress": {
"name": "Michael Kret",
"address": "MichaelDevSandbox@5w1hb7.onmicrosoft.com"
}
},
"from": {
"emailAddress": {
"name": "Michael Kret",
"address": "MichaelDevSandbox@5w1hb7.onmicrosoft.com"
}
},
"toRecipients": [
{
"emailAddress": {
"name": "reply@mail.com",
"address": "reply@mail.com"
}
}
],
"ccRecipients": [],
"bccRecipients": [],
"replyTo": [],
"flag": {
"flagStatus": "notFlagged"
}
}
}
]
},
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Microsoft Outlook",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "edd34dd1-0321-4d5b-a935-0c47d4c746b8",
"id": "1CYHzBXQw1nfPGtB",
"meta": {
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
},
"tags": []
}
@@ -0,0 +1,20 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('Test MicrosoftOutlookV2, message => send', () => {
nock('https://graph.microsoft.com')
.post('/v1.0/me/sendMail', {
message: {
body: { content: 'message description', contentType: 'Text' },
replyTo: [{ emailAddress: { address: 'reply@mail.com' } }],
subject: 'Hello',
toRecipients: [{ emailAddress: { address: 'to@mail.com' } }],
},
saveToSentItems: true,
})
.reply(200, {});
new NodeTestHarness().setupTests({
workflowFiles: ['send.workflow.json'],
});
});
@@ -0,0 +1,73 @@
{
"name": "My workflow 21",
"nodes": [
{
"parameters": {},
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
820,
360
]
},
{
"parameters": {
"toRecipients": "to@mail.com",
"subject": "Hello",
"bodyContent": "message description",
"additionalFields": {
"bodyContentType": "Text",
"replyTo": "reply@mail.com"
}
},
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
"name": "Microsoft Outlook",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
1040,
360
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "iXJCki7i5Vz0bdks",
"name": "Microsoft Outlook account 2"
}
}
}
],
"pinData": {
"Microsoft Outlook": [
{
"json": {
"success": true
}
}
]
},
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Microsoft Outlook",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "fed8ec2e-8663-4dfc-8234-33eb83257260",
"id": "1CYHzBXQw1nfPGtB",
"meta": {
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
},
"tags": []
}
@@ -0,0 +1,78 @@
import type { MockProxy } from 'jest-mock-extended';
import { mock } from 'jest-mock-extended';
import { SEND_AND_WAIT_OPERATION, type IExecuteFunctions } from 'n8n-workflow';
import { description } from '../../../../v2/actions/node.description';
import { MicrosoftOutlookV2 } from '../../../../v2/MicrosoftOutlookV2.node';
import * as transport from '../../../../v2/transport';
jest.mock('../../../../v2/transport', () => {
const originalModule = jest.requireActual('../../../../v2/transport');
return {
...originalModule,
microsoftApiRequest: jest.fn(async function (method: string) {
if (method === 'POST') {
return {};
}
}),
};
});
describe('Test MicrosoftOutlookV2, message => sendAndWait', () => {
let microsoftOutlook: MicrosoftOutlookV2;
let mockExecuteFunctions: MockProxy<IExecuteFunctions>;
beforeEach(() => {
microsoftOutlook = new MicrosoftOutlookV2(description);
mockExecuteFunctions = mock<IExecuteFunctions>();
});
afterEach(() => {
jest.clearAllMocks();
});
it('should send message and put execution to wait', async () => {
const items = [{ json: { data: 'test' } }];
//router
mockExecuteFunctions.getInputData.mockReturnValue(items);
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce('message');
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce(SEND_AND_WAIT_OPERATION);
mockExecuteFunctions.putExecutionToWait.mockImplementation();
//operation
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce('my@outlook.com');
mockExecuteFunctions.getInstanceId.mockReturnValue('instanceId');
//getSendAndWaitConfig
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce('my message');
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce('my subject');
mockExecuteFunctions.getSignedResumeUrl.mockReturnValue(
'http://localhost/waiting-webhook/nodeID?approved=true&signature=abc',
);
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce({}); // approvalOptions
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce({}); // options
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce('approval');
// configureWaitTillDate
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce({}); //options.limitWaitTime.values
const result = await microsoftOutlook.execute.call(mockExecuteFunctions);
expect(result).toEqual([items]);
expect(transport.microsoftApiRequest).toHaveBeenCalledTimes(1);
expect(mockExecuteFunctions.putExecutionToWait).toHaveBeenCalledTimes(1);
expect(transport.microsoftApiRequest).toHaveBeenCalledWith('POST', '/sendMail', {
message: {
body: {
content: expect.stringContaining(
'href="http://localhost/waiting-webhook/nodeID?approved=true&signature=abc"',
),
contentType: 'html',
},
subject: 'my subject',
toRecipients: [{ emailAddress: { address: 'my@outlook.com' } }],
},
});
});
});
@@ -0,0 +1,264 @@
import { mockDeep } from 'jest-mock-extended';
import type { IExecuteFunctions, INode } from 'n8n-workflow';
import { NodeOperationError } from 'n8n-workflow';
import { execute } from '../../../../v2/actions/messageAttachment/add.operation';
import * as transport from '../../../../v2/transport';
describe('Microsoft Outlook V2 - MessageAttachment:add', () => {
let mockExecuteFunctions: jest.Mocked<IExecuteFunctions>;
let microsoftApiRequestSpy: jest.SpyInstance;
const mockNode: INode = {
id: 'test-node-id',
name: 'Microsoft Outlook Test',
type: 'n8n-nodes-base.microsoftOutlook',
typeVersion: 2,
position: [0, 0],
parameters: {},
};
beforeEach(() => {
mockExecuteFunctions = mockDeep<IExecuteFunctions>();
microsoftApiRequestSpy = jest.spyOn(transport, 'microsoftApiRequest');
jest.clearAllMocks();
mockExecuteFunctions.getInputData.mockReturnValue([{ json: {} }]);
mockExecuteFunctions.getNode.mockReturnValue(mockNode);
mockExecuteFunctions.continueOnFail.mockReturnValue(false);
(mockExecuteFunctions.helpers.constructExecutionMetaData as jest.Mock).mockImplementation(
(data: any, options: any) => {
return data.map((item: any, index: number) => ({
...item,
pairedItem: { item: options?.itemData?.item ?? index },
}));
},
);
(mockExecuteFunctions.helpers.returnJsonArray as jest.Mock).mockImplementation((data: any) => {
return [{ json: data }];
});
});
afterEach(() => {
jest.resetAllMocks();
});
describe('Small file (under 3MB)', () => {
beforeEach(() => {
mockExecuteFunctions.getNodeParameter.mockImplementation((paramName: string) => {
const params: Record<string, any> = {
messageId: 'AAMkAGI2TG93AAA=',
binaryPropertyName: 'data',
options: {},
};
return params[paramName];
});
const mockBinaryData = {
data: 'SGVsbG8gV29ybGQ=',
mimeType: 'text/plain',
fileName: 'test-file.txt',
fileExtension: 'txt',
};
(mockExecuteFunctions.helpers.assertBinaryData as jest.Mock).mockReturnValue(mockBinaryData);
(mockExecuteFunctions.helpers.getBinaryDataBuffer as jest.Mock).mockResolvedValue(
Buffer.from('Hello World'),
);
});
it('should add small attachment successfully', async () => {
const mockResponse = {
'@odata.context':
"https://graph.microsoft.com/v1.0/$metadata#users('user-id')/messages('AAMkAGI2TG93AAA%3D')/attachments/$entity",
'@odata.type': '#microsoft.graph.fileAttachment',
id: 'AAMkAGI2TG93AAA=attachment-id',
lastModifiedDateTime: '2023-12-19T12:00:00Z',
name: 'test-file.txt',
contentType: 'text/plain',
size: 11,
isInline: false,
};
microsoftApiRequestSpy.mockResolvedValue(mockResponse);
const result = await execute.call(mockExecuteFunctions, 0, [{ json: {} }]);
expect(microsoftApiRequestSpy).toHaveBeenCalledWith(
'POST',
'/messages/AAMkAGI2TG93AAA=/attachments',
{
'@odata.type': '#microsoft.graph.fileAttachment',
name: 'test-file.txt',
contentBytes: 'SGVsbG8gV29ybGQ=',
},
{},
);
expect(result).toEqual([
{
json: { success: true },
pairedItem: { item: 0 },
},
]);
});
it('should use custom filename when provided', async () => {
mockExecuteFunctions.getNodeParameter.mockImplementation((paramName: string) => {
const params: Record<string, any> = {
messageId: 'AAMkAGI2TG93AAA=',
binaryPropertyName: 'data',
options: {
fileName: 'custom-name.pdf',
},
};
return params[paramName];
});
const mockBinaryData = {
data: 'JVBERi0xLjQK',
mimeType: 'application/pdf',
fileName: 'original-name.pdf',
fileExtension: 'pdf',
};
(mockExecuteFunctions.helpers.assertBinaryData as jest.Mock).mockReturnValue(mockBinaryData);
(mockExecuteFunctions.helpers.getBinaryDataBuffer as jest.Mock).mockResolvedValue(
Buffer.from('%PDF-1.4\n'),
);
microsoftApiRequestSpy.mockResolvedValue({});
await execute.call(mockExecuteFunctions, 0, [{ json: {} }]);
expect(microsoftApiRequestSpy).toHaveBeenCalledWith(
'POST',
'/messages/AAMkAGI2TG93AAA=/attachments',
{
'@odata.type': '#microsoft.graph.fileAttachment',
name: 'custom-name.pdf',
contentBytes: 'JVBERi0xLjQK',
},
{},
);
});
it('should throw error when fileName is not set', async () => {
mockExecuteFunctions.getNodeParameter.mockImplementation((paramName: string) => {
const params: Record<string, any> = {
messageId: 'AAMkAGI2TG93AAA=',
binaryPropertyName: 'data',
options: {},
};
return params[paramName];
});
const mockBinaryData = {
data: 'SGVsbG8gV29ybGQ=',
mimeType: 'text/plain',
};
(mockExecuteFunctions.helpers.assertBinaryData as jest.Mock).mockReturnValue(mockBinaryData);
(mockExecuteFunctions.helpers.getBinaryDataBuffer as jest.Mock).mockResolvedValue(
Buffer.from('Hello World'),
);
await expect(execute.call(mockExecuteFunctions, 0, [{ json: {} }])).rejects.toThrow(
NodeOperationError,
);
await expect(execute.call(mockExecuteFunctions, 0, [{ json: {} }])).rejects.toThrow(
'File name is not set',
);
});
});
describe('Large file (over 3MB) with chunked upload', () => {
beforeEach(() => {
mockExecuteFunctions.getNodeParameter.mockImplementation((paramName: string) => {
const params: Record<string, any> = {
messageId: 'AAMkAGI2TG93BBB=',
binaryPropertyName: 'data',
options: {},
};
return params[paramName];
});
const largeBinaryData = Buffer.alloc(4 * 1024 * 1024);
const mockBinaryData = {
data: largeBinaryData.toString('base64'),
mimeType: 'application/octet-stream',
fileName: 'large-file.bin',
fileExtension: 'bin',
};
(mockExecuteFunctions.helpers.assertBinaryData as jest.Mock).mockReturnValue(mockBinaryData);
(mockExecuteFunctions.helpers.getBinaryDataBuffer as jest.Mock).mockResolvedValue(
largeBinaryData,
);
});
it('should create upload session and upload large file in chunks', async () => {
const uploadUrl =
"https://outlook.office.com/api/v2.0/Users('user-id')/Messages('AAMkAGI2TG93BBB=')/AttachmentSessions('session-id')?authtoken=token";
microsoftApiRequestSpy.mockResolvedValueOnce({
'@odata.context':
'https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.uploadSession',
expirationDateTime: '2023-12-19T13:00:00.0000000Z',
nextExpectedRanges: ['0-'],
uploadUrl,
});
(mockExecuteFunctions.helpers.request as jest.Mock).mockResolvedValue({
'@odata.type': '#microsoft.graph.fileAttachment',
id: 'attachment-id',
name: 'large-file.bin',
size: 4 * 1024 * 1024,
});
const result = await execute.call(mockExecuteFunctions, 0, [{ json: {} }]);
expect(microsoftApiRequestSpy).toHaveBeenCalledWith(
'POST',
'/messages/AAMkAGI2TG93BBB=/attachments/createUploadSession',
{
AttachmentItem: {
attachmentType: 'file',
name: 'large-file.bin',
size: 4 * 1024 * 1024,
},
},
);
expect(mockExecuteFunctions.helpers.request).toHaveBeenCalledWith(
uploadUrl,
expect.objectContaining({
method: 'PUT',
headers: expect.objectContaining({
'Content-Type': 'application/octet-stream',
}),
}),
);
expect(result).toEqual([
{
json: { success: true },
pairedItem: { item: 0 },
},
]);
});
it('should throw error when upload session fails', async () => {
microsoftApiRequestSpy.mockResolvedValueOnce({
'@odata.context':
'https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.uploadSession',
});
await expect(execute.call(mockExecuteFunctions, 0, [{ json: {} }])).rejects.toThrow(
'Failed to get upload session',
);
});
});
});