AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
feat(microsoft-outlook): To/Cc/Bcc tabs, body format cards and clearer email and folder pickers (#15829)
Talal Jaberaf783f5cab9b
diff --git a/bun.lock b/bun.lockindex 59610777960..c063a3043e3 100644--- a/bun.lock+++ b/bun.lock@@ -5886,7 +5886,7 @@},"packages/pieces/community/microsoft-outlook": {"name": "@activepieces/piece-microsoft-outlook",- "version": "0.6.2",+ "version": "0.7.0","dependencies": {"@activepieces/core-piece-types": "workspace:*","@activepieces/core-utils": "workspace:*",diff --git a/packages/pieces/community/microsoft-outlook/package.json b/packages/pieces/community/microsoft-outlook/package.jsonindex 027d3d77b91..1eb059586aa 100644--- a/packages/pieces/community/microsoft-outlook/package.json+++ b/packages/pieces/community/microsoft-outlook/package.json@@ -1,6 +1,6 @@{"name": "@activepieces/piece-microsoft-outlook",- "version": "0.6.2",+ "version": "0.7.0","main": "./dist/src/index.js","types": "./dist/src/index.d.ts","dependencies": {diff --git a/packages/pieces/community/microsoft-outlook/src/index.ts b/packages/pieces/community/microsoft-outlook/src/index.tsindex 30c48cf718d..8be0a497fbf 100644--- a/packages/pieces/community/microsoft-outlook/src/index.ts+++ b/packages/pieces/community/microsoft-outlook/src/index.ts@@ -66,7 +66,7 @@ import { outlookUpdateMessageAction } from './lib/actions/outlook-update-messageexport const microsoftOutlook = createPiece({displayName: 'Microsoft Outlook',auth: microsoftOutlookAuth,- minimumSupportedRelease: '0.87.0',+ minimumSupportedRelease: '0.88.2',logoUrl: 'https://cdn.activepieces.com/pieces/microsoft-outlook.png',categories: [PieceCategory.PRODUCTIVITY],authors: ['lucaslimasouza', 'kishanprmr', 'sanket-a11y'],diff --git a/packages/pieces/community/microsoft-outlook/src/lib/actions/add-label-to-email.ts b/packages/pieces/community/microsoft-outlook/src/lib/actions/add-label-to-email.tsindex da396b83470..554698b203e 100644--- a/packages/pieces/community/microsoft-outlook/src/lib/actions/add-label-to-email.ts+++ b/packages/pieces/community/microsoft-outlook/src/lib/actions/add-label-to-email.ts@@ -9,19 +9,19 @@ export const addLabelToEmailAction = createAction({name: 'addLabelToEmail',classification: 'WRITE',displayName: 'Add Label to Email',- description: 'Adds a category (label) to an email message.',+ description: 'Tag an email with one or more Outlook categories.',audience: 'human',aiMetadata: { description: 'Adds one or more Outlook categories (labels) to a specific message, merging them with any categories already present. Use this to tag or classify an email. Idempotent: re-adding the same categories leaves the message unchanged since duplicates are de-duplicated.', idempotent: true },outputSchema: messageActionOutputSchema,props: {messageId: messageIdDropdown({displayName: 'Email',- description: 'Select the email message to add the label to.',+ description: 'The email to tag.',required: true,}),categories: Property.Array({displayName: 'Categories',- description: 'Categories to add to the email.',+ description: 'Category names to add, one per row.',required: true,}),},diff --git a/packages/pieces/community/microsoft-outlook/src/lib/actions/create-draft-email.ts b/packages/pieces/community/microsoft-outlook/src/lib/actions/create-draft-email.tsindex b2369ee66e3..9a8af7dbb7b 100644--- a/packages/pieces/community/microsoft-outlook/src/lib/actions/create-draft-email.ts+++ b/packages/pieces/community/microsoft-outlook/src/lib/actions/create-draft-email.ts@@ -9,38 +9,49 @@ export const createDraftEmailAction = createAction({name: 'createDraftEmail',classification: 'WRITE',displayName: 'Create Draft Email',- description: 'Creates a draft email message.',+ description: 'Save a new email to your Drafts folder without sending it.',audience: 'human',aiMetadata: { description: 'Creates a new unsent draft email in the Outlook mailbox with recipients, subject, body, and optional attachments. Use this to stage a message for later review or sending (pair with Send Draft Email). Not idempotent: each call creates a separate draft.', idempotent: false },outputSchema: draftMessageActionOutputSchema,+ propertyGroups: [+ {+ key: 'recipients',+ display: 'tabs',+ label: 'Recipients',+ props: ['recipients', 'ccRecipients', 'bccRecipients'],+ },+ ],props: {recipients: Property.Array({- displayName: 'To Email(s)',+ displayName: 'To',required: true,}),ccRecipients: Property.Array({- displayName: 'CC Email(s)',+ displayName: 'Cc',required: false,defaultValue: [],}),bccRecipients: Property.Array({- displayName: 'BCC Email(s)',+ displayName: 'Bcc',required: false,defaultValue: [],}),subject: Property.ShortText({displayName: 'Subject',+ placeholder: 'Invoice for March',required: true,}),bodyFormat: Property.StaticDropdown({displayName: 'Body Format',+ description: 'How the text in Body is interpreted.',required: true,defaultValue: 'text',+ display: 'cards',options: {disabled: false,options: [- { label: 'HTML', value: 'html' },- { label: 'Text', value: 'text' },+ { label: 'Plain Text', value: 'text', description: 'Sent as written', icon: 'text' },+ { label: 'HTML', value: 'html', description: 'Tags are rendered', icon: 'code' },],},}),@@ -58,16 +69,15 @@ export const createDraftEmailAction = createAction({required: true,}),fileName: Property.ShortText({- displayName: 'File Name',+ displayName: 'Attachment Name',+ description: 'Overrides the uploaded file name.',+ placeholder: 'report.pdf',required: false,}),},}),},async run(context) {- const recipients = context.propsValue.recipients as string[];- const ccRecipients = (context.propsValue.ccRecipients ?? []) as string[];- const bccRecipients = (context.propsValue.bccRecipients ?? []) as string[];const attachments = (context.propsValue.attachments ?? []) as Array<{ file: ApFile; fileName: string }>;const { subject, body, bodyFormat } = context.propsValue;@@ -78,21 +88,9 @@ export const createDraftEmailAction = createAction({content: body,contentType: bodyFormat as BodyType,},- toRecipients: recipients.map((mail) => ({- emailAddress: {- address: mail,- },- })),- ccRecipients: ccRecipients.map((mail) => ({- emailAddress: {- address: mail,- },- })),- bccRecipients: bccRecipients.map((mail) => ({- emailAddress: {- address: mail,- },- })),+ toRecipients: outlookCommon.toRecipients(context.propsValue.recipients),+ ccRecipients: outlookCommon.toRecipients(context.propsValue.ccRecipients),+ bccRecipients: outlookCommon.toRecipients(context.propsValue.bccRecipients),attachments: attachments.map((attachment) => ({'@odata.type': '#microsoft.graph.fileAttachment',name: attachment.fileName || attachment.file.filename,diff --git a/packages/pieces/community/microsoft-outlook/src/lib/actions/download-email-attachment.ts b/packages/pieces/community/microsoft-outlook/src/lib/actions/download-email-attachment.tsindex 54e588974e1..60ae5c6de04 100644--- a/packages/pieces/community/microsoft-outlook/src/lib/actions/download-email-attachment.ts+++ b/packages/pieces/community/microsoft-outlook/src/lib/actions/download-email-attachment.ts@@ -10,14 +10,14 @@ export const downloadAttachmentAction = createAction({name: 'downloadAttachment',classification: 'READ',displayName: 'Download Attachment',- description: 'Download attachments from a specific email message.',+ description: 'Save the files attached to an email so later steps can use them.',audience: 'human',aiMetadata: { description: 'Fetches all file attachments from a specific Outlook message (by message ID) and writes them to storage for downstream steps. Use this after locating a message to retrieve its attached files. Requires a valid message ID; idempotent since it only reads.', idempotent: true },outputSchema: downloadAttachmentActionOutputSchema,props: {messageId: Property.ShortText({displayName: 'Message ID',- description: 'The ID of the email message containing the attachment.',+ description: 'Map it from a Find Email step or an Outlook trigger.',required: true,}),},diff --git a/packages/pieces/community/microsoft-outlook/src/lib/actions/find-email.ts b/packages/pieces/community/microsoft-outlook/src/lib/actions/find-email.tsindex 15a9f3d012e..3a986574ebd 100644--- a/packages/pieces/community/microsoft-outlook/src/lib/actions/find-email.ts+++ b/packages/pieces/community/microsoft-outlook/src/lib/actions/find-email.ts@@ -12,27 +12,31 @@ export const findEmailAction = createAction({name: 'findEmail',classification: 'SEARCH',displayName: 'Find Email',- description: 'Searches for emails using full-text search.',+ description: 'Search your mailbox by keywords, sender or subject.',audience: 'human',aiMetadata: { description: 'Searches the Outlook mailbox for messages matching a full-text query (supports field syntax like from:, subject:, hasAttachments:), optionally scoped to one folder and capped by a max-results count. Use this to locate emails and obtain their message IDs for follow-up actions. Idempotent read-only lookup.', idempotent: true },outputSchema: findEmailActionOutputSchema,props: {searchQuery: Property.ShortText({displayName: 'Search Query',- description:- 'Search terms to find emails (e.g., "from:[email protected]", "subject:urgent", "hasAttachments:true")',+ description: 'Words to find. Narrow with from:, subject: or hasAttachments:true.',+ placeholder: 'from:[email protected] invoice',required: true,}),folderId: mailFolderIdDropdown({displayName: 'Folder',- description: 'Search in a specific folder. Leave empty to search all folders.',+ description: 'Leave empty to search every folder.',required: false,}),top: Property.Number({displayName: 'Max Results',- description: 'Maximum number of results to return (1-1000).',+ description: 'How many emails to return, up to 1000.',required: false,defaultValue: 25,+ display: 'stepper',+ min: 1,+ max: 1000,+ step: 1,}),},async run(context) {diff --git a/packages/pieces/community/microsoft-outlook/src/lib/actions/forward-email.ts b/packages/pieces/community/microsoft-outlook/src/lib/actions/forward-email.tsindex 004d5b35800..cbdd027aedc 100644--- a/packages/pieces/community/microsoft-outlook/src/lib/actions/forward-email.ts+++ b/packages/pieces/community/microsoft-outlook/src/lib/actions/forward-email.ts@@ -1,5 +1,5 @@import { createAction, Property } from '@activepieces/pieces-framework';-import { BodyType, Message } from '@microsoft/microsoft-graph-types';+import { Message } from '@microsoft/microsoft-graph-types';import { microsoftOutlookAuth } from '../common/auth';import { outlookCommon } from '../common/client';import { messageIdDropdown } from '../common/props';@@ -10,40 +10,36 @@ export const forwardEmailAction = createAction({name: 'forwardEmail',classification: 'WRITE',displayName: 'Forward Email',- description: 'Forwards an email message.',+ description: 'Forward an email to new recipients with an optional note.',audience: 'human',aiMetadata: { description: 'Forwards an existing Outlook message (by message ID) to new recipients, preserving the original body and attachments and prepending an optional comment. Use this to pass an existing email along rather than composing a new one. Not idempotent: each call sends a new forwarded email.', idempotent: false },outputSchema: forwardEmailActionOutputSchema,props: {messageId: messageIdDropdown({displayName: 'Email',- description: 'Select the email message to forward.',+ description: 'The email to forward.',required: true,}),recipients: Property.Array({- displayName: 'To Email(s)',+ displayName: 'To',+ description: 'One address per row.',required: true,}),comment: Property.LongText({displayName: 'Comment',- description: 'Optional comment to include with the forwarded message.',+ description: 'Added above the forwarded email. HTML tags are rendered.',required: false,}),},async run(context) {const { messageId, comment } = context.propsValue;- const recipients = context.propsValue.recipients as string[];const client = outlookCommon.createClient(context.auth);const message = await client.api(`${outlookCommon.mailboxPrefix(context.auth)}/messages/${messageId}`).get();const messagePayload: Message = {- toRecipients: recipients.map((mail) => ({- emailAddress: {- address: mail,- },- })),+ toRecipients: outlookCommon.toRecipients(context.propsValue.recipients),body: {contentType: 'html',content: (comment ?? '') + '<br><br>' + message.body.content,diff --git a/packages/pieces/community/microsoft-outlook/src/lib/actions/move-email-to-folder.ts b/packages/pieces/community/microsoft-outlook/src/lib/actions/move-email-to-folder.tsindex 75a0635c4b3..e76446eb3ba 100644--- a/packages/pieces/community/microsoft-outlook/src/lib/actions/move-email-to-folder.ts+++ b/packages/pieces/community/microsoft-outlook/src/lib/actions/move-email-to-folder.ts@@ -1,4 +1,4 @@-import { createAction, Property } from '@activepieces/pieces-framework';+import { createAction } from '@activepieces/pieces-framework';import { microsoftOutlookAuth } from '../common/auth';import { outlookCommon } from '../common/client';import { mailFolderIdDropdown, messageIdDropdown } from '../common/props';@@ -9,19 +9,19 @@ export const moveEmailToFolderAction = createAction({name: 'moveEmailToFolder',classification: 'WRITE',displayName: 'Move Email to Folder',- description: 'Moves an email message to a specific folder.',+ description: 'Move an email into another folder.',audience: 'human',aiMetadata: { description: 'Moves a specific Outlook message into a chosen mail folder. Use this to organize, archive, or route an email after processing it. Note: the move assigns a new message ID, so re-running with the original ID will fail once moved.', idempotent: false },outputSchema: messageActionOutputSchema,props: {messageId: messageIdDropdown({displayName: 'Email',- description: 'Select the email message to move.',+ description: 'The email to move.',required: true,}),destinationFolderId: mailFolderIdDropdown({displayName: 'Destination Folder',- description: 'The folder to move the email to.',+ description: 'Folder to move the email into.',required: true,}),},diff --git a/packages/pieces/community/microsoft-outlook/src/lib/actions/remove-label-from-email.ts b/packages/pieces/community/microsoft-outlook/src/lib/actions/remove-label-from-email.tsindex ab1e99160e0..eabb3ceef54 100644--- a/packages/pieces/community/microsoft-outlook/src/lib/actions/remove-label-from-email.ts+++ b/packages/pieces/community/microsoft-outlook/src/lib/actions/remove-label-from-email.ts@@ -9,19 +9,19 @@ export const removeLabelFromEmailAction = createAction({name: 'removeLabelFromEmail',classification: 'WRITE',displayName: 'Remove Label from Email',- description: 'Removes a category (label) from an email message.',+ description: 'Remove one or more Outlook categories from an email.',audience: 'human',aiMetadata: { description: 'Removes one or more Outlook categories (labels) from a specific message, leaving any other categories intact. Use this to untag or reclassify an email. Idempotent: re-running with the same categories yields the same final label set.', idempotent: true },outputSchema: messageActionOutputSchema,props: {messageId: messageIdDropdown({displayName: 'Email',- description: 'Select the email message to remove the label from.',+ description: 'The email to remove categories from.',required: true,}),categories: Property.Array({- displayName: 'Categories to Remove',- description: 'Categories to remove from the email.',+ displayName: 'Categories',+ description: 'Category names to remove, one per row.',required: true,}),},diff --git a/packages/pieces/community/microsoft-outlook/src/lib/actions/reply-email.ts b/packages/pieces/community/microsoft-outlook/src/lib/actions/reply-email.tsindex 2557bb80def..4e8f6eab337 100644--- a/packages/pieces/community/microsoft-outlook/src/lib/actions/reply-email.ts+++ b/packages/pieces/community/microsoft-outlook/src/lib/actions/reply-email.ts@@ -1,8 +1,8 @@-import { ApFile, createAction, Property, OAuth2PropertyValue } from '@activepieces/pieces-framework';+import { ApFile, createAction, Property } from '@activepieces/pieces-framework';import { microsoftOutlookAuth } from '../common/auth';import { outlookCommon } from '../common/client';+import { messageIdDropdown } from '../common/props';import { BodyType, Message } from '@microsoft/microsoft-graph-types';-import { PageCollection } from '@microsoft/microsoft-graph-client';import { replyEmailActionOutputSchema } from '../output-schemas';export const replyEmailAction = createAction({@@ -10,72 +10,48 @@ export const replyEmailAction = createAction({name: 'reply-email',classification: 'WRITE',displayName: 'Reply to Email',- description: 'Reply to an outlook email.',+ description: 'Reply to an Outlook email, or save the reply as a draft.',audience: 'human',aiMetadata: { description: 'Replies to an existing Outlook message (identified by message ID), supporting added CC/BCC recipients and attachments. Set the Create Draft flag to stage the reply without sending; otherwise it is sent immediately. Not idempotent when sending: each call creates and dispatches a new reply.', idempotent: false },outputSchema: replyEmailActionOutputSchema,+ propertyGroups: [+ {+ key: 'recipients',+ display: 'tabs',+ label: 'Cc and Bcc',+ props: ['ccRecipients', 'bccRecipients'],+ },+ ],props: {- messageId: Property.Dropdown({- auth: microsoftOutlookAuth,+ messageId: messageIdDropdown({displayName: 'Email',- description: 'Select the email message to reply to.',+ description: 'The email to reply to.',required: true,- refreshers: [],- options: async ({ auth }) => {- if (!auth) {- return {- disabled: true,- options: [],- };- }-- const client = outlookCommon.createClient(auth as OAuth2PropertyValue);-- try {- const response: PageCollection = await client- .api(`${outlookCommon.mailboxPrefix(auth as OAuth2PropertyValue)}/messages?$top=50&$select=id,subject,from,receivedDateTime`)- .orderby('receivedDateTime desc')- .get();-- const messages = response.value as Message[];-- return {- disabled: false,- options: messages.map((message) => ({- label: `${message.subject || 'No Subject'} - ${message.from?.emailAddress?.name || message.from?.emailAddress?.address || 'Unknown Sender'}`,- value: message.id || '',- })),- };- } catch (error) {- return {- disabled: true,- options: [],- };- }- },}),bodyFormat: Property.StaticDropdown({displayName: 'Body Format',+ description: 'How the text in Body is interpreted.',required: true,defaultValue: 'text',+ display: 'cards',options: {disabled: false,options: [- { label: 'HTML', value: 'html' },- { label: 'Text', value: 'text' },+ { label: 'Plain Text', value: 'text', description: 'Sent as written', icon: 'text' },+ { label: 'HTML', value: 'html', description: 'Tags are rendered', icon: 'code' },],},}),replyBody: Property.LongText({- displayName: 'Reply Body',+ displayName: 'Body',required: true,}),ccRecipients: Property.Array({- displayName: 'CC Recipients',+ displayName: 'Cc',required: false,}),bccRecipients: Property.Array({- displayName: 'BCC Recipients',+ displayName: 'Bcc',required: false,}),attachments: Property.Array({@@ -88,22 +64,22 @@ export const replyEmailAction = createAction({required: true,}),fileName: Property.ShortText({- displayName: 'File Name',+ displayName: 'Attachment Name',+ description: 'Overrides the uploaded file name.',+ placeholder: 'report.pdf',required: false,}),},}),draft: Property.Checkbox({- displayName: 'Create Draft',- description: 'If enabled, creates draft without sending.',- required: true,+ displayName: 'Save as Draft',+ description: 'Save the reply to Drafts instead of sending it.',+ required: false,defaultValue: false,}),},async run(context) {const { replyBody, bodyFormat, messageId, draft } = context.propsValue;- const ccRecipients = (context.propsValue.ccRecipients ?? []) as string[];- const bccRecipients = (context.propsValue.bccRecipients ?? []) as string[];const attachments = (context.propsValue.attachments ?? []) as Array<{file: ApFile;fileName: string;@@ -113,16 +89,8 @@ export const replyEmailAction = createAction({content: replyBody,contentType: bodyFormat as BodyType,},- ccRecipients: ccRecipients.map((mail) => ({- emailAddress: {- address: mail,- },- })),- bccRecipients: bccRecipients.map((mail) => ({- emailAddress: {- address: mail,- },- })),+ ccRecipients: outlookCommon.toRecipients(context.propsValue.ccRecipients),+ bccRecipients: outlookCommon.toRecipients(context.propsValue.bccRecipients),attachments: attachments.map((attachment) => ({'@odata.type': '#microsoft.graph.fileAttachment',name: attachment.fileName || attachment.file.filename,diff --git a/packages/pieces/community/microsoft-outlook/src/lib/actions/request-approval-send-email.ts b/packages/pieces/community/microsoft-outlook/src/lib/actions/request-approval-send-email.tsindex 346c0fd60ca..2f0aac0b6ff 100644--- a/packages/pieces/community/microsoft-outlook/src/lib/actions/request-approval-send-email.ts+++ b/packages/pieces/community/microsoft-outlook/src/lib/actions/request-approval-send-email.ts@@ -12,26 +12,26 @@ export const requestApprovalInMail = createAction({classification: 'WRITE',displayName: 'Request Approval in Email',description:- 'Send approval request email and then wait until the email is approved or disapproved',+ 'Send an email with an approval link and pause until it is answered.',audience: 'both',aiMetadata: { description: 'Sends an email with a single link to a confirmation page where the recipient chooses Approve or Disapprove, then pauses the flow until they respond, resuming with the decision. Use this as a human-in-the-loop approval gate before proceeding. Not idempotent: each call sends a new email and creates a new pending waitpoint.', idempotent: false },outputSchema: requestApprovalActionOutputSchema,props: {recipients: Property.ShortText({- displayName: 'To Email Address',- description:- 'The email address of the recipient who will receive the approval request.',+ displayName: 'To',+ description: 'Address that receives the approval request.',+ placeholder: '[email protected]',required: true,}),subject: Property.ShortText({displayName: 'Subject',- description: 'The subject of the approval request email.',+ placeholder: 'Approval needed: purchase order 1042',required: true,}),body: Property.LongText({displayName: 'Body',description:- 'The main content of the email. You can include details about the approval request here in the html format or plain text.',+ 'Shown above the Review & Respond button. HTML tags are rendered.',required: true,}),},@@ -80,7 +80,7 @@ export const requestApprovalInMail = createAction({],};- const sendResult = await client.api(`${outlookCommon.mailboxPrefix(context.auth)}/sendMail`).post({+ await client.api(`${outlookCommon.mailboxPrefix(context.auth)}/sendMail`).post({message: mailPayload,saveToSentItems: true,});diff --git a/packages/pieces/community/microsoft-outlook/src/lib/actions/send-draft-email.ts b/packages/pieces/community/microsoft-outlook/src/lib/actions/send-draft-email.tsindex 0a1e90ddff3..259cfa3d55b 100644--- a/packages/pieces/community/microsoft-outlook/src/lib/actions/send-draft-email.ts+++ b/packages/pieces/community/microsoft-outlook/src/lib/actions/send-draft-email.ts@@ -9,14 +9,14 @@ export const sendDraftEmailAction = createAction({name: 'sendDraftEmail',classification: 'WRITE',displayName: 'Send Draft Email',- description: 'Sends a draft email message.',+ description: 'Send an email that is waiting in your Drafts folder.',audience: 'human',aiMetadata: { description: 'Sends an existing draft email (identified by draft message ID) from the Outlook mailbox. Use this to dispatch a draft previously staged by Create Draft Email or a draft reply. Not idempotent: once sent the draft no longer exists, so re-running with the same ID will fail.', idempotent: false },outputSchema: sendDraftEmailActionOutputSchema,props: {messageId: draftMessageIdDropdown({- displayName: 'Draft Email',- description: 'Select the draft email message to send.',+ displayName: 'Email',+ description: 'Pick a draft from your Drafts folder.',required: true,}),},diff --git a/packages/pieces/community/microsoft-outlook/src/lib/actions/send-email.ts b/packages/pieces/community/microsoft-outlook/src/lib/actions/send-email.tsindex 4e1d79d3462..5ae666b8e99 100644--- a/packages/pieces/community/microsoft-outlook/src/lib/actions/send-email.ts+++ b/packages/pieces/community/microsoft-outlook/src/lib/actions/send-email.ts@@ -9,37 +9,48 @@ export const sendEmailAction = createAction({name: 'send-email',classification: 'WRITE',displayName: 'Send Email',- description: 'Sends an email using Microsoft Outlook.',+ description: 'Send an email from your Outlook mailbox.',audience: 'human',aiMetadata: { description: 'Composes and sends a new email from the authenticated Outlook mailbox to the given recipients, with optional CC/BCC and file attachments. Use this to send a fresh message (not a reply or forward). Not idempotent: each call dispatches a new email and saves a copy to Sent Items.', idempotent: false },+ propertyGroups: [+ {+ key: 'recipients',+ display: 'tabs',+ label: 'Recipients',+ props: ['recipients', 'ccRecipients', 'bccRecipients'],+ },+ ],props: {recipients: Property.Array({- displayName: 'To Email(s)',+ displayName: 'To',required: true,}),ccRecipients: Property.Array({- displayName: 'CC Email(s)',+ displayName: 'Cc',required: false,defaultValue: [],}),bccRecipients: Property.Array({- displayName: 'BCC Email(s)',+ displayName: 'Bcc',required: false,defaultValue: [],}),subject: Property.ShortText({displayName: 'Subject',+ placeholder: 'Invoice for March',required: true,}),bodyFormat: Property.StaticDropdown({displayName: 'Body Format',+ description: 'How the text in Body is interpreted.',required: true,defaultValue: 'text',+ display: 'cards',options: {disabled: false,options: [- { label: 'HTML', value: 'html' },- { label: 'Text', value: 'text' },+ { label: 'Plain Text', value: 'text', description: 'Sent as written', icon: 'text' },+ { label: 'HTML', value: 'html', description: 'Tags are rendered', icon: 'code' },],},}),@@ -57,16 +68,15 @@ export const sendEmailAction = createAction({required: true,}),fileName: Property.ShortText({- displayName: 'File Name',+ displayName: 'Attachment Name',+ description: 'Overrides the uploaded file name.',+ placeholder: 'report.pdf',required: false,}),},}),},async run(context) {- const recipients = context.propsValue.recipients as string[];- const ccRecipients = (context.propsValue.ccRecipients ?? []) as string[];- const bccRecipients = (context.propsValue.bccRecipients ?? []) as string[];const attachments = (context.propsValue.attachments ?? []) as Array<{ file: ApFile; fileName: string }>;const { subject, body, bodyFormat } = context.propsValue;@@ -77,21 +87,9 @@ export const sendEmailAction = createAction({content: body,contentType: bodyFormat as BodyType,},- toRecipients: recipients.map((mail) => ({- emailAddress: {- address: mail,- },- })),- ccRecipients: ccRecipients.map((mail) => ({- emailAddress: {- address: mail,- },- })),- bccRecipients: bccRecipients.map((mail) => ({- emailAddress: {- address: mail,- },- })),+ toRecipients: outlookCommon.toRecipients(context.propsValue.recipients),+ ccRecipients: outlookCommon.toRecipients(context.propsValue.ccRecipients),+ bccRecipients: outlookCommon.toRecipients(context.propsValue.bccRecipients),attachments: attachments.map((attachment) => ({'@odata.type': '#microsoft.graph.fileAttachment',name: attachment.fileName || attachment.file.filename,diff --git a/packages/pieces/community/microsoft-outlook/src/lib/common/client.ts b/packages/pieces/community/microsoft-outlook/src/lib/common/client.tsindex 053592f58ee..73783982b26 100644--- a/packages/pieces/community/microsoft-outlook/src/lib/common/client.ts+++ b/packages/pieces/community/microsoft-outlook/src/lib/common/client.ts@@ -1,5 +1,6 @@import { OAuth2PropertyValue } from '@activepieces/pieces-framework';import { Client } from '@microsoft/microsoft-graph-client';+import { Recipient } from '@microsoft/microsoft-graph-types';import { getGraphBaseUrl, getMicrosoftCloudFromAuth } from './microsoft-cloud';function createClient(auth: OAuth2PropertyValue): Client {@@ -23,4 +24,15 @@ function mailboxPrefix(auth: OAuth2PropertyValue): string {return mailbox ? `/users/${encodeURIComponent(mailbox)}` : '/me';}-export const outlookCommon = { createClient, mailboxPrefix };+function toRecipients(addresses: unknown): Recipient[] {+ if (!Array.isArray(addresses)) {+ return [];+ }+ return addresses+ .filter((entry) => entry !== null && entry !== undefined)+ .map((entry) => String(entry).trim())+ .filter((address) => address.length > 0)+ .map((address) => ({ emailAddress: { address } }));+}++export const outlookCommon = { createClient, mailboxPrefix, toRecipients };diff --git a/packages/pieces/community/microsoft-outlook/src/lib/common/props.ts b/packages/pieces/community/microsoft-outlook/src/lib/common/props.tsindex 95b632c9c83..a9293394237 100644--- a/packages/pieces/community/microsoft-outlook/src/lib/common/props.ts+++ b/packages/pieces/community/microsoft-outlook/src/lib/common/props.ts@@ -1,5 +1,5 @@-import { OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';-import { PageCollection } from '@microsoft/microsoft-graph-client';+import { OAuth2PropertyValue, Property, tryCatch } from '@activepieces/pieces-framework';+import { Client, PageCollection } from '@microsoft/microsoft-graph-client';import { MailFolder, Message } from '@microsoft/microsoft-graph-types';import { microsoftOutlookAuth } from './auth';import { outlookCommon } from './client';@@ -20,7 +20,7 @@ export const messageIdDropdown = (params: DropdownParams) =>options: async ({ auth }) => {if (!auth) {return {- placeholder: 'Please connect your account first.',+ placeholder: 'Please connect your Outlook account first.',disabled: true,options: [],};@@ -40,7 +40,7 @@ export const messageIdDropdown = (params: DropdownParams) =>return {disabled: false,options: messages.map((message) => ({- label: `${message.subject || 'No Subject'}`,+ label: `${message.subject || 'No Subject'} - ${message.from?.emailAddress?.name || message.from?.emailAddress?.address || 'Unknown Sender'}`,value: message.id,})),};@@ -48,6 +48,7 @@ export const messageIdDropdown = (params: DropdownParams) =>return {disabled: true,options: [],+ placeholder: 'Could not load emails. Check your connection.',};}},@@ -63,7 +64,7 @@ export const draftMessageIdDropdown = (params: DropdownParams) =>options: async ({ auth }) => {if (!auth) {return {- placeholder: 'Please connect your account first.',+ placeholder: 'Please connect your Outlook account first.',disabled: true,options: [],};@@ -74,7 +75,7 @@ export const draftMessageIdDropdown = (params: DropdownParams) =>try {const response: PageCollection = await client- .api(`${outlookCommon.mailboxPrefix(authValue)}/mailFolders/drafts/messages?$top=50&$select=id,subject,from,receivedDateTime`)+ .api(`${outlookCommon.mailboxPrefix(authValue)}/mailFolders/drafts/messages?$top=50&$select=id,subject,from,toRecipients,receivedDateTime`).orderby('receivedDateTime desc').get();@@ -83,7 +84,7 @@ export const draftMessageIdDropdown = (params: DropdownParams) =>return {disabled: false,options: messages.map((message) => ({- label: `${message.subject || 'No Subject'}`,+ label: draftLabel(message),value: message.id,})),};@@ -91,6 +92,7 @@ export const draftMessageIdDropdown = (params: DropdownParams) =>return {disabled: true,options: [],+ placeholder: 'Could not load drafts. Check your connection.',};}},@@ -106,7 +108,7 @@ export const mailFolderIdDropdown = (params: DropdownParams) =>options: async ({ auth }) => {if (!auth) {return {- placeholder: 'Please connect your account first.',+ placeholder: 'Please connect your Outlook account first.',disabled: true,options: [],};@@ -115,23 +117,51 @@ export const mailFolderIdDropdown = (params: DropdownParams) =>const authValue = auth as OAuth2PropertyValue;const client = outlookCommon.createClient(authValue);- try {- const response: PageCollection = await client.api(`${outlookCommon.mailboxPrefix(authValue)}/mailFolders`).get();-- const folders = response.value as MailFolder[];+ const { folders, failed } = await fetchAllFolders({+ client,+ firstPageUrl: `${outlookCommon.mailboxPrefix(authValue)}/mailFolders?$top=100`,+ });- return {- disabled: false,- options: folders.map((folder) => ({- label: folder.displayName || folder.id || 'Unknown',- value: folder.id || '',- })),- };- } catch (error) {+ if (failed && folders.length === 0) {return {disabled: true,options: [],+ placeholder: 'Could not load folders. Check your connection.',};}++ return {+ disabled: false,+ options: folders.map((folder) => ({+ label: folder.displayName || 'Unnamed folder',+ value: folder.id || '',+ })),+ };},});++async function fetchAllFolders({ client, firstPageUrl }: { client: Client; firstPageUrl: string }): Promise<FolderPages> {+ const folders: MailFolder[] = [];+ let nextLink: string | undefined = firstPageUrl;+ while (nextLink) {+ const pageUrl: string = nextLink;+ const page = await tryCatch<PageCollection>(() => client.api(pageUrl).get());+ if (page.error !== null) {+ return { folders, failed: true };+ }+ folders.push(...page.data.value);+ nextLink = page.data['@odata.nextLink'];+ }+ return { folders, failed: false };+}++function draftLabel(message: Message): string {+ const subject = message.subject || 'No Subject';+ const firstRecipient = message.toRecipients?.[0]?.emailAddress?.address;+ return firstRecipient ? `${subject} - to ${firstRecipient}` : subject;+}++type FolderPages = {+ folders: MailFolder[];+ failed: boolean;+};diff --git a/packages/pieces/community/microsoft-outlook/src/lib/triggers/new-attachment.ts b/packages/pieces/community/microsoft-outlook/src/lib/triggers/new-attachment.tsindex 187b392657a..9e0fa25f97e 100644--- a/packages/pieces/community/microsoft-outlook/src/lib/triggers/new-attachment.ts+++ b/packages/pieces/community/microsoft-outlook/src/lib/triggers/new-attachment.ts@@ -28,7 +28,7 @@ export const newAttachmentTrigger = createTrigger({name: 'newAttachment',classification: 'READ',displayName: 'New Attachment',- description: 'Triggers when a new email containing one or more attachments arrives.',+ description: 'Triggers once for each attachment on a new email.',aiMetadata: {description:'Fires once per attachment when a new email carrying one or more file attachments arrives, optionally scoped to a folder, sender, attachment-name, or file-extension filter. Each fire represents a single attachment from a newly received message.',@@ -37,18 +37,19 @@ export const newAttachmentTrigger = createTrigger({props: {folderId: mailFolderIdDropdown({displayName: 'Folder',- description: 'Monitor attachments in a specific folder. Leave empty to monitor all folders.',+ description: 'Leave empty to watch the whole mailbox, including sent mail.',required: false,}),sender: Property.ShortText({- displayName: 'From (Sender Email)',- description:- 'Filter emails from a specific sender (contains). Leave empty to include all senders.',+ displayName: 'From',+ description: 'Only emails whose sender address contains this text.',+ placeholder: '[email protected]',required: false,}),attachmentNameFilter: Property.ShortText({- displayName: 'Attachment Name Filter',- description: 'Filter attachments by name (contains). Leave empty to include all attachments.',+ displayName: 'Attachment Name',+ description: 'Only attachments whose file name contains this text.',+ placeholder: 'invoice',required: false,}),fileExtension: Property.ShortText({diff --git a/packages/pieces/community/microsoft-outlook/src/lib/triggers/new-email-in-folder.ts b/packages/pieces/community/microsoft-outlook/src/lib/triggers/new-email-in-folder.tsindex e7a4d395680..1884e125d66 100644--- a/packages/pieces/community/microsoft-outlook/src/lib/triggers/new-email-in-folder.ts+++ b/packages/pieces/community/microsoft-outlook/src/lib/triggers/new-email-in-folder.ts@@ -1,7 +1,6 @@import { DedupeStrategy, Polling, pollingHelper } from '@activepieces/pieces-common';import {AppConnectionValueForAuthProperty,- PiecePropValueSchema,TriggerStrategy,createTrigger,} from '@activepieces/pieces-framework';@@ -61,7 +60,7 @@ export const newEmailInFolderTrigger = createTrigger({name: 'newEmailInFolder',classification: 'READ',displayName: 'New Email in Folder',- description: 'Triggers when a new email is delivered into the specified folder.',+ description: 'Triggers when a new email lands in the folder you pick.',aiMetadata: {description: 'Fires when a new message appears in the chosen Outlook mail folder. Each fire represents one new email added to that folder.',},@@ -69,7 +68,7 @@ export const newEmailInFolderTrigger = createTrigger({props: {folderId: mailFolderIdDropdown({displayName: 'Folder',- description: '',+ description: 'New emails in this folder start the flow.',required: true,}),},diff --git a/packages/pieces/community/microsoft-outlook/src/lib/triggers/new-email.ts b/packages/pieces/community/microsoft-outlook/src/lib/triggers/new-email.tsindex 1a8cce68aa4..9cb3623cea3 100644--- a/packages/pieces/community/microsoft-outlook/src/lib/triggers/new-email.ts+++ b/packages/pieces/community/microsoft-outlook/src/lib/triggers/new-email.ts@@ -87,21 +87,24 @@ export const newEmailTrigger = createTrigger({name: 'newEmail',classification: 'READ',displayName: 'New Email',- description: 'Triggers when a new email is received in the inbox.',+ description: 'Triggers when a new email arrives in your Inbox.',aiMetadata: {description: 'Fires when a new message arrives in the mailbox Inbox, optionally narrowed to a specific sender and/or recipient address. Each fire represents one newly received email.',},outputSchema: newEmailTriggerOutputSchema,props: {sender: Property.ShortText({- displayName: 'From (Sender Email)',- description: 'Filter emails from a specific sender (optional). Leave empty to for all senders.',+ displayName: 'From',+ description: 'Only emails sent from this address.',+ placeholder: '[email protected]',required: false,}),recipient: Property.ShortText({- displayName: 'To (Recipient Email)',- description: 'Filter emails to a specific recipient (optional). Leave empty to for all recipients.',+ displayName: 'To',+ description: 'Only emails sent to this address.',+ placeholder: '[email protected]',required: false,+ advanced: true,}),},sampleData: {},