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
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:
@@ -0,0 +1,255 @@
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
INodeExecutionData,
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
import { createMessage } from '../../helpers/utils';
|
||||
import { microsoftApiRequest } from '../../transport';
|
||||
|
||||
export const properties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
description: 'The subject of the message',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Message',
|
||||
name: 'bodyContent',
|
||||
description: 'Message body content',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
rows: 2,
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Attachments',
|
||||
name: 'attachments',
|
||||
type: 'fixedCollection',
|
||||
placeholder: 'Add Attachment',
|
||||
default: {},
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'attachments',
|
||||
displayName: 'Attachment',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Input Data Field Name',
|
||||
name: 'binaryPropertyName',
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: 'e.g. data',
|
||||
hint: 'The name of the input field containing the binary file data to be attached',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'BCC Recipients',
|
||||
name: 'bccRecipients',
|
||||
description: 'Comma-separated list of email addresses of BCC recipients',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. john@example.com',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Category Names or IDs',
|
||||
name: 'categories',
|
||||
type: 'multiOptions',
|
||||
description:
|
||||
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getCategoriesNames',
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
{
|
||||
displayName: 'CC Recipients',
|
||||
name: 'ccRecipients',
|
||||
description: 'Comma-separated list of email addresses of CC recipients',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. john@example.com',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Custom Headers',
|
||||
name: 'internetMessageHeaders',
|
||||
placeholder: 'Add Header',
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
name: 'headers',
|
||||
displayName: 'Header',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Name of the header',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Value to set for the header',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'From',
|
||||
name: 'from',
|
||||
description:
|
||||
'The owner of the mailbox from which the message is sent. Must correspond to the actual mailbox used.',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. john@example.com',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Importance',
|
||||
name: 'importance',
|
||||
description: 'The importance of the message',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Low',
|
||||
value: 'Low',
|
||||
},
|
||||
{
|
||||
name: 'Normal',
|
||||
value: 'Normal',
|
||||
},
|
||||
{
|
||||
name: 'High',
|
||||
value: 'High',
|
||||
},
|
||||
],
|
||||
default: 'Normal',
|
||||
},
|
||||
{
|
||||
displayName: 'Message Type',
|
||||
name: 'bodyContentType',
|
||||
description: 'Message body content type',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'HTML',
|
||||
value: 'html',
|
||||
},
|
||||
{
|
||||
name: 'Text',
|
||||
value: 'Text',
|
||||
},
|
||||
],
|
||||
default: 'html',
|
||||
},
|
||||
{
|
||||
displayName: 'Read Receipt Requested',
|
||||
name: 'isReadReceiptRequested',
|
||||
description: 'Whether a read receipt is requested for the message',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Reply To',
|
||||
name: 'replyTo',
|
||||
description: 'Email address to use when replying',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. replyto@example.com',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'To',
|
||||
name: 'toRecipients',
|
||||
description: 'Comma-separated list of email addresses of recipients',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. john@example.com',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['draft'],
|
||||
operation: ['create'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(this: IExecuteFunctions, index: number, _: INodeExecutionData[]) {
|
||||
const additionalFields = this.getNodeParameter('additionalFields', index);
|
||||
const subject = this.getNodeParameter('subject', index) as string;
|
||||
const bodyContent = this.getNodeParameter('bodyContent', index, '') as string;
|
||||
|
||||
additionalFields.subject = subject;
|
||||
|
||||
additionalFields.bodyContent = bodyContent || ' ';
|
||||
|
||||
// Create message object from optional fields
|
||||
const body: IDataObject = createMessage(additionalFields);
|
||||
|
||||
if (additionalFields.attachments) {
|
||||
const attachments = (additionalFields.attachments as IDataObject).attachments as IDataObject[];
|
||||
|
||||
// // Handle attachments
|
||||
body.attachments = await Promise.all(
|
||||
attachments.map(async (attachment) => {
|
||||
const binaryPropertyName = attachment.binaryPropertyName as string;
|
||||
|
||||
const binaryData = this.helpers.assertBinaryData(index, binaryPropertyName);
|
||||
|
||||
let fileBase64;
|
||||
if (binaryData.id) {
|
||||
const chunkSize = 256 * 1024;
|
||||
const stream = await this.helpers.getBinaryStream(binaryData.id, chunkSize);
|
||||
const buffer = await this.helpers.binaryToBuffer(stream);
|
||||
fileBase64 = buffer.toString('base64');
|
||||
} else {
|
||||
fileBase64 = binaryData.data;
|
||||
}
|
||||
|
||||
return {
|
||||
'@odata.type': '#microsoft.graph.fileAttachment',
|
||||
name: binaryData.fileName,
|
||||
contentBytes: fileBase64,
|
||||
};
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
const responseData = await microsoftApiRequest.call(this, 'POST', '/messages', body, {});
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData as IDataObject),
|
||||
{ itemData: { item: index } },
|
||||
);
|
||||
|
||||
return executionData;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import type { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
import { draftRLC } from '../../descriptions';
|
||||
import { microsoftApiRequest } from '../../transport';
|
||||
|
||||
export const properties: INodeProperties[] = [draftRLC];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['draft'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(this: IExecuteFunctions, index: number) {
|
||||
const draftId = this.getNodeParameter('draftId', index, undefined, {
|
||||
extractValue: true,
|
||||
}) as string;
|
||||
await microsoftApiRequest.call(this, 'DELETE', `/messages/${draftId}`);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ success: true }),
|
||||
{ itemData: { item: index } },
|
||||
);
|
||||
|
||||
return executionData;
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
INodeExecutionData,
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
import { draftRLC } from '../../descriptions';
|
||||
import { messageFields, simplifyOutputMessages } from '../../helpers/utils';
|
||||
import { downloadAttachments, microsoftApiRequest } from '../../transport';
|
||||
|
||||
export const properties: INodeProperties[] = [
|
||||
draftRLC,
|
||||
{
|
||||
displayName: 'Output',
|
||||
name: 'output',
|
||||
type: 'options',
|
||||
default: 'simple',
|
||||
options: [
|
||||
{
|
||||
name: 'Simplified',
|
||||
value: 'simple',
|
||||
},
|
||||
{
|
||||
name: 'Raw',
|
||||
value: 'raw',
|
||||
},
|
||||
{
|
||||
name: 'Select Included Fields',
|
||||
value: 'fields',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Fields',
|
||||
name: 'fields',
|
||||
type: 'multiOptions',
|
||||
description: 'The fields to add to the output',
|
||||
displayOptions: {
|
||||
show: {
|
||||
output: ['fields'],
|
||||
},
|
||||
},
|
||||
options: messageFields,
|
||||
default: [],
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
type: 'collection',
|
||||
placeholder: 'Add option',
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Attachments Prefix',
|
||||
name: 'attachmentsPrefix',
|
||||
type: 'string',
|
||||
default: 'attachment_',
|
||||
description:
|
||||
'Prefix for name of the output fields to put the binary files data in. An index starting from 0 will be added. So if name is "attachment_" the first attachment is saved to "attachment_0".',
|
||||
},
|
||||
{
|
||||
displayName: 'Download Attachments',
|
||||
name: 'downloadAttachments',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description:
|
||||
"Whether the message's attachments will be downloaded and included in the output",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['draft'],
|
||||
operation: ['get'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(this: IExecuteFunctions, index: number) {
|
||||
let responseData;
|
||||
const qs: IDataObject = {};
|
||||
|
||||
const draftId = this.getNodeParameter('draftId', index, undefined, {
|
||||
extractValue: true,
|
||||
}) as string;
|
||||
const options = this.getNodeParameter('options', index, {});
|
||||
const output = this.getNodeParameter('output', index) as string;
|
||||
|
||||
if (output === 'fields') {
|
||||
const fields = this.getNodeParameter('fields', index) as string[];
|
||||
|
||||
if (options.downloadAttachments) {
|
||||
fields.push('hasAttachments');
|
||||
}
|
||||
|
||||
qs.$select = fields.join(',');
|
||||
}
|
||||
|
||||
if (output === 'simple') {
|
||||
qs.$select =
|
||||
'id,conversationId,subject,bodyPreview,from,toRecipients,categories,hasAttachments';
|
||||
}
|
||||
|
||||
responseData = await microsoftApiRequest.call(this, 'GET', `/messages/${draftId}`, undefined, qs);
|
||||
|
||||
if (output === 'simple') {
|
||||
responseData = simplifyOutputMessages([responseData as IDataObject]);
|
||||
}
|
||||
|
||||
let executionData: INodeExecutionData[] = [];
|
||||
|
||||
if (options.downloadAttachments) {
|
||||
const prefix = (options.attachmentsPrefix as string) || 'attachment_';
|
||||
executionData = await downloadAttachments.call(this, responseData as IDataObject, prefix);
|
||||
} else {
|
||||
executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData as IDataObject),
|
||||
{ itemData: { item: index } },
|
||||
);
|
||||
}
|
||||
|
||||
return executionData;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import * as create from './create.operation';
|
||||
import * as del from './delete.operation';
|
||||
import * as get from './get.operation';
|
||||
import * as send from './send.operation';
|
||||
import * as update from './update.operation';
|
||||
|
||||
export { create, del as delete, get, send, update };
|
||||
|
||||
export const description: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['draft'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a new email draft',
|
||||
action: 'Create a draft',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete an email draft',
|
||||
action: 'Delete a draft',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Retrieve an email draft',
|
||||
action: 'Get a draft',
|
||||
},
|
||||
{
|
||||
name: 'Send',
|
||||
value: 'send',
|
||||
description: 'Send an existing email draft',
|
||||
action: 'Send a draft',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update an email draft',
|
||||
action: 'Update a draft',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
|
||||
...create.description,
|
||||
...del.description,
|
||||
...get.description,
|
||||
...send.description,
|
||||
...update.description,
|
||||
];
|
||||
@@ -0,0 +1,54 @@
|
||||
import type { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
import { draftRLC } from '../../descriptions';
|
||||
import { makeRecipient } from '../../helpers/utils';
|
||||
import { microsoftApiRequest } from '../../transport';
|
||||
|
||||
export const properties: INodeProperties[] = [
|
||||
draftRLC,
|
||||
{
|
||||
displayName: 'To',
|
||||
name: 'to',
|
||||
description: 'Comma-separated list of email addresses of recipients',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['draft'],
|
||||
operation: ['send'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(this: IExecuteFunctions, index: number) {
|
||||
const draftId = this.getNodeParameter('draftId', index, undefined, { extractValue: true });
|
||||
const to = this.getNodeParameter('to', index) as string;
|
||||
|
||||
if (to) {
|
||||
const recipients = to
|
||||
.split(',')
|
||||
.map((s) => s.trim())
|
||||
.filter((email) => email);
|
||||
|
||||
if (recipients.length !== 0) {
|
||||
await microsoftApiRequest.call(this, 'PATCH', `/messages/${draftId}`, {
|
||||
toRecipients: recipients.map((recipient: string) => makeRecipient(recipient)),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
await microsoftApiRequest.call(this, 'POST', `/messages/${draftId}/send`);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ success: true }),
|
||||
{ itemData: { item: index } },
|
||||
);
|
||||
|
||||
return executionData;
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
import type { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
import { draftRLC } from '../../descriptions';
|
||||
import { createMessage } from '../../helpers/utils';
|
||||
import { microsoftApiRequest } from '../../transport';
|
||||
|
||||
export const properties: INodeProperties[] = [
|
||||
draftRLC,
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'BCC Recipients',
|
||||
name: 'bccRecipients',
|
||||
description: 'Comma-separated list of email addresses of BCC recipients',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. john@example.com',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Category Names or IDs',
|
||||
name: 'categories',
|
||||
type: 'multiOptions',
|
||||
description:
|
||||
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getCategoriesNames',
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
{
|
||||
displayName: 'CC Recipients',
|
||||
name: 'ccRecipients',
|
||||
description: 'Comma-separated list of email addresses of CC recipients',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. john@example.com',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Custom Headers',
|
||||
name: 'internetMessageHeaders',
|
||||
placeholder: 'Add Header',
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
name: 'headers',
|
||||
displayName: 'Header',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Name of the header',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Value to set for the header',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'From',
|
||||
name: 'from',
|
||||
description:
|
||||
'The owner of the mailbox from which the message is sent. Must correspond to the actual mailbox used.',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. john@example.com',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Importance',
|
||||
name: 'importance',
|
||||
description: 'The importance of the message',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Low',
|
||||
value: 'Low',
|
||||
},
|
||||
{
|
||||
name: 'Normal',
|
||||
value: 'Normal',
|
||||
},
|
||||
{
|
||||
name: 'High',
|
||||
value: 'High',
|
||||
},
|
||||
],
|
||||
default: 'Normal',
|
||||
},
|
||||
{
|
||||
displayName: 'Is Read',
|
||||
name: 'isRead',
|
||||
description: 'Whether the message must be marked as read',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Message',
|
||||
name: 'bodyContent',
|
||||
description: 'Message body content',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
rows: 2,
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Message Type',
|
||||
name: 'bodyContentType',
|
||||
description: 'Message body content type',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'HTML',
|
||||
value: 'html',
|
||||
},
|
||||
{
|
||||
name: 'Text',
|
||||
value: 'Text',
|
||||
},
|
||||
],
|
||||
default: 'html',
|
||||
},
|
||||
{
|
||||
displayName: 'Read Receipt Requested',
|
||||
name: 'isReadReceiptRequested',
|
||||
description: 'Whether a read receipt is requested for the message',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Reply To',
|
||||
name: 'replyTo',
|
||||
description: 'Email address to use when replying',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. replyto@example.com',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
description: 'The subject of the message',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'To',
|
||||
name: 'toRecipients',
|
||||
description: 'Comma-separated list of email addresses of recipients',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. john@example.com',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['draft'],
|
||||
operation: ['update'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(this: IExecuteFunctions, index: number) {
|
||||
const draftId = this.getNodeParameter('draftId', index, undefined, {
|
||||
extractValue: true,
|
||||
}) as string;
|
||||
|
||||
const updateFields = this.getNodeParameter('updateFields', index);
|
||||
|
||||
// Create message from optional fields
|
||||
const body: IDataObject = createMessage(updateFields);
|
||||
|
||||
const responseData = await microsoftApiRequest.call(
|
||||
this,
|
||||
'PATCH',
|
||||
`/messages/${draftId}`,
|
||||
body,
|
||||
{},
|
||||
);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData as IDataObject),
|
||||
{ itemData: { item: index } },
|
||||
);
|
||||
|
||||
return executionData;
|
||||
}
|
||||
Reference in New Issue
Block a user