@pipedream/microsoft_outlook 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/add-label-to-email/add-label-to-email.mjs +45 -0
- package/actions/create-contact/create-contact.mjs +1 -1
- package/actions/create-draft-email/create-draft-email.mjs +1 -1
- package/actions/find-contacts/find-contacts.mjs +1 -1
- package/actions/list-contacts/list-contacts.mjs +1 -1
- package/actions/list-labels/list-labels.mjs +21 -0
- package/actions/remove-label-from-email/remove-label-from-email.mjs +47 -0
- package/actions/send-email/send-email.mjs +1 -1
- package/actions/update-contact/update-contact.mjs +1 -1
- package/microsoft_outlook.app.mjs +50 -0
- package/package.json +2 -1
- package/sources/new-contact/new-contact.mjs +1 -1
- package/sources/new-email/new-email.mjs +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import microsoftOutlook from "../../microsoft_outlook.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "microsoft_outlook-add-label-to-email",
|
|
5
|
+
name: "Add Label to Email",
|
|
6
|
+
description: "Adds a label/category to an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/message-update)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
microsoftOutlook,
|
|
11
|
+
messageId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
microsoftOutlook,
|
|
14
|
+
"messageId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
labelId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
microsoftOutlook,
|
|
20
|
+
"labelId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
async run({ $ }) {
|
|
25
|
+
const message = await this.microsoftOutlook.getMessage({
|
|
26
|
+
$,
|
|
27
|
+
messageId: this.messageId,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const labels = message?.categories;
|
|
31
|
+
|
|
32
|
+
const response = await this.microsoftOutlook.updateMessage({
|
|
33
|
+
$,
|
|
34
|
+
messageId: this.messageId,
|
|
35
|
+
data: {
|
|
36
|
+
categories: [
|
|
37
|
+
...labels,
|
|
38
|
+
this.labelId,
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
$.export("$summary", "Successfully added label to message.");
|
|
43
|
+
return response;
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
type: "action",
|
|
5
5
|
key: "microsoft_outlook-create-contact",
|
|
6
|
-
version: "0.0.
|
|
6
|
+
version: "0.0.8",
|
|
7
7
|
name: "Create Contact",
|
|
8
8
|
description: "Add a contact to the root Contacts folder, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-post-contacts)",
|
|
9
9
|
props: {
|
|
@@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
type: "action",
|
|
5
5
|
key: "microsoft_outlook-create-draft-email",
|
|
6
|
-
version: "0.0.
|
|
6
|
+
version: "0.0.8",
|
|
7
7
|
name: "Create Draft Email",
|
|
8
8
|
description: "Create a draft email, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-post-messages)",
|
|
9
9
|
props: {
|
|
@@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
type: "action",
|
|
5
5
|
key: "microsoft_outlook-find-contacts",
|
|
6
|
-
version: "0.0.
|
|
6
|
+
version: "0.0.8",
|
|
7
7
|
name: "Find Contacts",
|
|
8
8
|
description: "Finds contacts with given search string",
|
|
9
9
|
props: {
|
|
@@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
type: "action",
|
|
5
5
|
key: "microsoft_outlook-list-contacts",
|
|
6
|
-
version: "0.0.
|
|
6
|
+
version: "0.0.8",
|
|
7
7
|
name: "List Contacts",
|
|
8
8
|
description: "Get a contact collection from the default contacts folder, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-list-contacts)",
|
|
9
9
|
props: {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import microsoftOutlook from "../../microsoft_outlook.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "microsoft_outlook-list-labels",
|
|
5
|
+
name: "List Labels",
|
|
6
|
+
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.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
microsoftOutlook,
|
|
11
|
+
},
|
|
12
|
+
async run({ $ }) {
|
|
13
|
+
const { value } = await this.microsoftOutlook.listLabels({
|
|
14
|
+
$,
|
|
15
|
+
});
|
|
16
|
+
$.export("$summary", `Successfully retrieved ${value.length} label${value.length != 1
|
|
17
|
+
? "s"
|
|
18
|
+
: ""}.`);
|
|
19
|
+
return value;
|
|
20
|
+
},
|
|
21
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import microsoftOutlook from "../../microsoft_outlook.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "microsoft_outlook-remove-label-from-email",
|
|
5
|
+
name: "Remove Label from Email",
|
|
6
|
+
description: "Removes a label/category from an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/message-update)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
microsoftOutlook,
|
|
11
|
+
messageId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
microsoftOutlook,
|
|
14
|
+
"messageId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
labelId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
microsoftOutlook,
|
|
20
|
+
"labelId",
|
|
21
|
+
],
|
|
22
|
+
description: "The identifier of the label/category to remove",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
async run({ $ }) {
|
|
26
|
+
const message = await this.microsoftOutlook.getMessage({
|
|
27
|
+
$,
|
|
28
|
+
messageId: this.messageId,
|
|
29
|
+
});
|
|
30
|
+
let labels = message?.categories;
|
|
31
|
+
|
|
32
|
+
const index = labels.indexOf(this.labelId);
|
|
33
|
+
if (index > -1) {
|
|
34
|
+
labels.splice(index, 1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const response = await this.microsoftOutlook.updateMessage({
|
|
38
|
+
$,
|
|
39
|
+
messageId: this.messageId,
|
|
40
|
+
data: {
|
|
41
|
+
categories: labels,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
$.export("$summary", "Successfully removed label from message.");
|
|
45
|
+
return response;
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
type: "action",
|
|
5
5
|
key: "microsoft_outlook-send-email",
|
|
6
|
-
version: "0.0.
|
|
6
|
+
version: "0.0.9",
|
|
7
7
|
name: "Send Email",
|
|
8
8
|
description: "Send an email to one or multiple recipients, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-sendmail)",
|
|
9
9
|
props: {
|
|
@@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
type: "action",
|
|
5
5
|
key: "microsoft_outlook-update-contact",
|
|
6
|
-
version: "0.0.
|
|
6
|
+
version: "0.0.8",
|
|
7
7
|
name: "Update Contact",
|
|
8
8
|
description: "Add a contact to the root Contacts folder, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-post-contacts)",
|
|
9
9
|
props: {
|
|
@@ -100,6 +100,41 @@ export default {
|
|
|
100
100
|
type: "object",
|
|
101
101
|
optional: true,
|
|
102
102
|
},
|
|
103
|
+
labelId: {
|
|
104
|
+
type: "string",
|
|
105
|
+
label: "Label ID",
|
|
106
|
+
description: "The identifier of the label/category to add",
|
|
107
|
+
async options() {
|
|
108
|
+
const { value: labels } = await this.listLabels();
|
|
109
|
+
return labels?.map(({
|
|
110
|
+
id: value, displayName: label,
|
|
111
|
+
}) => ({
|
|
112
|
+
value,
|
|
113
|
+
label,
|
|
114
|
+
})) || [];
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
messageId: {
|
|
118
|
+
type: "string",
|
|
119
|
+
label: "Message ID",
|
|
120
|
+
description: "The identifier of the message to update",
|
|
121
|
+
async options({ page }) {
|
|
122
|
+
const limit = 50;
|
|
123
|
+
const { value } = await this.listMessages({
|
|
124
|
+
params: {
|
|
125
|
+
$top: limit,
|
|
126
|
+
$skip: limit * page,
|
|
127
|
+
$orderby: "createdDateTime desc",
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
return value?.map(({
|
|
131
|
+
id: value, subject: label,
|
|
132
|
+
}) => ({
|
|
133
|
+
value,
|
|
134
|
+
label,
|
|
135
|
+
})) || [];
|
|
136
|
+
},
|
|
137
|
+
},
|
|
103
138
|
},
|
|
104
139
|
methods: {
|
|
105
140
|
_getUrl(path) {
|
|
@@ -286,5 +321,20 @@ export default {
|
|
|
286
321
|
...args,
|
|
287
322
|
});
|
|
288
323
|
},
|
|
324
|
+
listLabels(args = {}) {
|
|
325
|
+
return this._makeRequest({
|
|
326
|
+
path: "/me/outlook/masterCategories",
|
|
327
|
+
...args,
|
|
328
|
+
});
|
|
329
|
+
},
|
|
330
|
+
updateMessage({
|
|
331
|
+
messageId, ...args
|
|
332
|
+
}) {
|
|
333
|
+
return this._makeRequest({
|
|
334
|
+
method: "PATCH",
|
|
335
|
+
path: `/me/messages/${messageId}`,
|
|
336
|
+
...args,
|
|
337
|
+
});
|
|
338
|
+
},
|
|
289
339
|
},
|
|
290
340
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/microsoft_outlook",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Pipedream Microsoft Outlook Components",
|
|
5
5
|
"main": "microsoft_outlook.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"homepage": "https://pipedream.com/apps/microsoft_outlook",
|
|
13
13
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
14
14
|
"dependencies": {
|
|
15
|
+
"@pipedream/platform": "^3.0.3",
|
|
15
16
|
"axios": "^0.21.1",
|
|
16
17
|
"js-base64": "^3.7.2",
|
|
17
18
|
"md5": "^2.3.0",
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
key: "microsoft_outlook-new-email",
|
|
8
8
|
name: "New Email Event (Instant)",
|
|
9
9
|
description: "Emit new event when an email is received in specified folders.",
|
|
10
|
-
version: "0.0.
|
|
10
|
+
version: "0.0.12",
|
|
11
11
|
type: "source",
|
|
12
12
|
dedupe: "unique",
|
|
13
13
|
props: {
|