Skip to content

Commit 15a6b1c

Browse files
authored
Microsoft Outlook: New Attachment Received & Download Attachment (#16324)
* new components * versions * dedupe by contentId
1 parent 65e79d1 commit 15a6b1c

File tree

22 files changed

+268
-70
lines changed

22 files changed

+268
-70
lines changed

components/microsoft_outlook/actions/add-label-to-email/add-label-to-email.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "microsoft_outlook-add-label-to-email",
66
name: "Add Label to Email",
77
description: "Adds a label/category to an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/message-update)",
8-
version: "0.0.5",
8+
version: "0.0.6",
99
type: "action",
1010
props: {
1111
microsoftOutlook,

components/microsoft_outlook/actions/approve-workflow/approve-workflow.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "microsoft_outlook-approve-workflow",
55
name: "Approve Workflow",
66
description: "Suspend the workflow until approved by email. [See the documentation](https://pipedream.com/docs/code/nodejs/rerun#flowsuspend)",
7-
version: "0.0.3",
7+
version: "0.0.4",
88
type: "action",
99
props: {
1010
microsoftOutlook,

components/microsoft_outlook/actions/create-contact/create-contact.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
33
export default {
44
type: "action",
55
key: "microsoft_outlook-create-contact",
6-
version: "0.0.12",
6+
version: "0.0.13",
77
name: "Create Contact",
88
description: "Add a contact to the root Contacts folder, [See the documentation](https://docs.microsoft.com/en-us/graph/api/user-post-contacts)",
99
props: {

components/microsoft_outlook/actions/create-draft-email/create-draft-email.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
33
export default {
44
type: "action",
55
key: "microsoft_outlook-create-draft-email",
6-
version: "0.0.12",
6+
version: "0.0.13",
77
name: "Create Draft Email",
88
description: "Create a draft email, [See the documentation](https://docs.microsoft.com/en-us/graph/api/user-post-messages)",
99
props: {
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import microsoftOutlook from "../../microsoft_outlook.app.mjs";
2+
import fs from "fs";
3+
import mime from "mime-types";
4+
5+
export default {
6+
key: "microsoft_outlook-download-attachment",
7+
name: "Download Attachment",
8+
description: "Downloads an attachment to the /tmp directory. [See the documentation](https://learn.microsoft.com/en-us/graph/api/attachment-get?view=graph-rest-1.0&tabs=http)",
9+
version: "0.0.1",
10+
type: "action",
11+
props: {
12+
microsoftOutlook,
13+
messageId: {
14+
propDefinition: [
15+
microsoftOutlook,
16+
"messageId",
17+
],
18+
description: "The identifier of the message containing the attachment to download",
19+
},
20+
attachmentId: {
21+
propDefinition: [
22+
microsoftOutlook,
23+
"attachmentId",
24+
(c) => ({
25+
messageId: c.messageId,
26+
}),
27+
],
28+
},
29+
filename: {
30+
type: "string",
31+
label: "Filename",
32+
description: "The filename to save the attachment as in the /tmp directory",
33+
},
34+
},
35+
async run({ $ }) {
36+
const response = await this.microsoftOutlook.getAttachment({
37+
$,
38+
messageId: this.messageId,
39+
attachmentId: this.attachmentId,
40+
responseType: "arraybuffer",
41+
});
42+
43+
const rawcontent = response.toString("base64");
44+
const buffer = Buffer.from(rawcontent, "base64");
45+
const downloadedFilepath = `/tmp/${this.filename}`;
46+
fs.writeFileSync(downloadedFilepath, buffer);
47+
const contentType = mime.lookup(downloadedFilepath);
48+
49+
return {
50+
fileName: this.filename,
51+
contentType,
52+
filePath: downloadedFilepath,
53+
};
54+
},
55+
};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
33
export default {
44
type: "action",
55
key: "microsoft_outlook-find-contacts",
6-
version: "0.0.12",
6+
version: "0.0.13",
77
name: "Find Contacts",
88
description: "Finds contacts with the given search string. [See the documentation](https://docs.microsoft.com/en-us/graph/api/user-list-contacts)",
99
props: {

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

Lines changed: 1 addition & 1 deletion
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.3",
7+
version: "0.0.4",
88
type: "action",
99
props: {
1010
microsoftOutlook,

components/microsoft_outlook/actions/list-contacts/list-contacts.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
33
export default {
44
type: "action",
55
key: "microsoft_outlook-list-contacts",
6-
version: "0.0.12",
6+
version: "0.0.13",
77
name: "List Contacts",
88
description: "Get a contact collection from the default contacts folder, [See the documentation](https://docs.microsoft.com/en-us/graph/api/user-list-contacts)",
99
props: {

components/microsoft_outlook/actions/list-folders/list-folders.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "microsoft_outlook-list-folders",
55
name: "List Folders",
66
description: "Retrieves a list of all folders in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/user-list-mailfolders)",
7-
version: "0.0.3",
7+
version: "0.0.4",
88
type: "action",
99
props: {
1010
microsoftOutlook,

components/microsoft_outlook/actions/list-labels/list-labels.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "microsoft_outlook-list-labels",
55
name: "List Labels",
66
description: "Get all the labels/categories that have been defined for a user. [See the documentation](https://learn.microsoft.com/en-us/graph/api/outlookuser-list-mastercategories)",
7-
version: "0.0.5",
7+
version: "0.0.6",
88
type: "action",
99
props: {
1010
microsoftOutlook,

0 commit comments

Comments
 (0)