Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,15 @@
key: "microsoft_outlook-find-email",
name: "Find Email",
description: "Search for an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/user-list-messages)",
version: "0.0.8",
version: "0.0.9",
type: "action",
props: {
microsoftOutlook,
info: {

Check warning on line 11 in components/microsoft_outlook/actions/find-email/find-email.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop info must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 11 in components/microsoft_outlook/actions/find-email/find-email.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop info must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
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).",
},
search: {
type: "string",
label: "Search",
description: "Search for an email in Microsoft Outlook. Can search for specific message properties such as `to:example@example.com` 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:example@example.com` will only search for messages to `example@example.com`.",
optional: true,
},
filter: {
type: "string",
label: "Filter",
Expand All @@ -44,7 +38,6 @@
args: {
$,
params: {
"$search": this.search,
"$filter": this.filter,
"$orderby": this.orderBy,
},
Expand Down
2 changes: 1 addition & 1 deletion components/microsoft_outlook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/microsoft_outlook",
"version": "1.5.4",
"version": "1.5.5",
"description": "Pipedream Microsoft Outlook Components",
"main": "microsoft_outlook.app.mjs",
"keywords": [
Expand Down
17 changes: 17 additions & 0 deletions components/microsoft_outlook/sources/common/common-new-email.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,22 @@ export default {
const draftsFolderId = this.db.get("draftsFolderId");
return item.parentFolderId !== sentItemFolderId && item.parentFolderId !== draftsFolderId;
},
async getMessageAttachments(message) {
const { value: attachments } = await this.microsoftOutlook.listAttachments({
messageId: message.id,
});
if (!attachments?.length) {
return [];
}
return attachments.map((attachment) => ({
...attachment,
messageId: message.id,
messageSubject: message.subject,
messageSender: message.sender,
messageReceivedDateTime: message.receivedDateTime,
parentFolderId: message.parentFolderId,
contentBytes: undefined,
}));
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "microsoft_outlook-new-attachment-received",
name: "New Attachment Received (Instant)",
description: "Emit new event when a new email containing one or more attachments arrives in a specified Microsoft Outlook folder.",
version: "0.0.3",
version: "0.0.4",
type: "source",
dedupe: "unique",
methods: {
Expand Down Expand Up @@ -36,23 +36,6 @@ export default {
}
return attachments;
},
async getMessageAttachments(message) {
const { value: attachments } = await this.microsoftOutlook.listAttachments({
messageId: message.id,
});
if (!attachments?.length) {
return [];
}
return attachments.map((attachment) => ({
...attachment,
messageId: message.id,
messageSubject: message.subject,
messageSender: message.sender,
messageReceivedDateTime: message.receivedDateTime,
parentFolderId: message.parentFolderId,
contentBytes: undefined,
}));
},
emitEvent(item) {
if (this.isRelevant(item)) {
this.$emit(item, this.generateMeta(item));
Expand Down
6 changes: 5 additions & 1 deletion components/microsoft_outlook/sources/new-email/new-email.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "microsoft_outlook-new-email",
name: "New Email Event (Instant)",
description: "Emit new event when an email is received in specified folders.",
version: "0.0.19",
version: "0.1.0",
type: "source",
dedupe: "unique",
methods: {
Expand Down Expand Up @@ -66,6 +66,10 @@ export default {
resource: folder,
messageId: resourceId,
});
if (item.hasAttachments) {
const attachments = await this.getMessageAttachments(item);
item.attachments = attachments;
}
this.emitEvent(item);
} catch {
console.log(`Could not fetch message with ID: ${resourceId}`);
Expand Down
Loading