Skip to content

Commit e9191fc

Browse files
MS Outlook - include attachments in new email trigger (#18291)
* Revert "[Components] Add `search` param support to outlook `find-email` (#18211)" This reverts commit 7b47c94 and revs the version. * include attachment in new email trigger * fix package version
1 parent fbc56f0 commit e9191fc

File tree

5 files changed

+25
-28
lines changed

5 files changed

+25
-28
lines changed

components/microsoft_outlook/actions/find-email/find-email.mjs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "microsoft_outlook-find-email",
55
name: "Find Email",
66
description: "Search for an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/user-list-messages)",
7-
version: "0.0.8",
7+
version: "0.0.9",
88
type: "action",
99
props: {
1010
microsoftOutlook,
@@ -13,12 +13,6 @@ export default {
1313
alertType: "info",
1414
content: "When you specify `$filter`, the service infers a sort order for the results. If you use both `$orderby` and `$filter` to get messages, because the server always infers a sort order for the results of a `$filter`, you must [specify properties in certain ways](https://learn.microsoft.com/en-us/graph/api/user-list-messages#using-filter-and-orderby-in-the-same-query).",
1515
},
16-
search: {
17-
type: "string",
18-
label: "Search",
19-
description: "Search for an email in Microsoft Outlook. Can search for specific message properties such as `to:[email protected]` or `subject:example`. If the property is excluded, the search targets the default propertes `from`, `subject`, and `body`. For example, `pizza` will search for messages with the word `pizza` in the subject, body, or from address, but `to:[email protected]` will only search for messages to `[email protected]`.",
20-
optional: true,
21-
},
2216
filter: {
2317
type: "string",
2418
label: "Filter",
@@ -44,7 +38,6 @@ export default {
4438
args: {
4539
$,
4640
params: {
47-
"$search": this.search,
4841
"$filter": this.filter,
4942
"$orderby": this.orderBy,
5043
},

components/microsoft_outlook/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/microsoft_outlook",
3-
"version": "1.5.4",
3+
"version": "1.5.5",
44
"description": "Pipedream Microsoft Outlook Components",
55
"main": "microsoft_outlook.app.mjs",
66
"keywords": [

components/microsoft_outlook/sources/common/common-new-email.mjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,22 @@ export default {
5454
const draftsFolderId = this.db.get("draftsFolderId");
5555
return item.parentFolderId !== sentItemFolderId && item.parentFolderId !== draftsFolderId;
5656
},
57+
async getMessageAttachments(message) {
58+
const { value: attachments } = await this.microsoftOutlook.listAttachments({
59+
messageId: message.id,
60+
});
61+
if (!attachments?.length) {
62+
return [];
63+
}
64+
return attachments.map((attachment) => ({
65+
...attachment,
66+
messageId: message.id,
67+
messageSubject: message.subject,
68+
messageSender: message.sender,
69+
messageReceivedDateTime: message.receivedDateTime,
70+
parentFolderId: message.parentFolderId,
71+
contentBytes: undefined,
72+
}));
73+
},
5774
},
5875
};

components/microsoft_outlook/sources/new-attachment-received/new-attachment-received.mjs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "microsoft_outlook-new-attachment-received",
66
name: "New Attachment Received (Instant)",
77
description: "Emit new event when a new email containing one or more attachments arrives in a specified Microsoft Outlook folder.",
8-
version: "0.0.3",
8+
version: "0.0.4",
99
type: "source",
1010
dedupe: "unique",
1111
methods: {
@@ -36,23 +36,6 @@ export default {
3636
}
3737
return attachments;
3838
},
39-
async getMessageAttachments(message) {
40-
const { value: attachments } = await this.microsoftOutlook.listAttachments({
41-
messageId: message.id,
42-
});
43-
if (!attachments?.length) {
44-
return [];
45-
}
46-
return attachments.map((attachment) => ({
47-
...attachment,
48-
messageId: message.id,
49-
messageSubject: message.subject,
50-
messageSender: message.sender,
51-
messageReceivedDateTime: message.receivedDateTime,
52-
parentFolderId: message.parentFolderId,
53-
contentBytes: undefined,
54-
}));
55-
},
5639
emitEvent(item) {
5740
if (this.isRelevant(item)) {
5841
this.$emit(item, this.generateMeta(item));

components/microsoft_outlook/sources/new-email/new-email.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
key: "microsoft_outlook-new-email",
88
name: "New Email Event (Instant)",
99
description: "Emit new event when an email is received in specified folders.",
10-
version: "0.0.19",
10+
version: "0.1.0",
1111
type: "source",
1212
dedupe: "unique",
1313
methods: {
@@ -66,6 +66,10 @@ export default {
6666
resource: folder,
6767
messageId: resourceId,
6868
});
69+
if (item.hasAttachments) {
70+
const attachments = await this.getMessageAttachments(item);
71+
item.attachments = attachments;
72+
}
6973
this.emitEvent(item);
7074
} catch {
7175
console.log(`Could not fetch message with ID: ${resourceId}`);

0 commit comments

Comments
 (0)