Skip to content

Commit 87c3440

Browse files
authored
Microsoft Components (#15443)
* microsoft_outlook_calendar components * microsoft_onedrive component * microsoft_outlook components * pnpm-lock.yaml * remove console.log
1 parent a9c0553 commit 87c3440

File tree

19 files changed

+346
-19
lines changed

19 files changed

+346
-19
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import onedrive from "../../microsoft_onedrive.app.mjs";
2+
3+
export default {
4+
key: "microsoft_onedrive-get-file-by-id",
5+
name: "Get File by ID",
6+
description: "Retrieves a file by ID. [See the documentation](https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_get)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
onedrive,
11+
fileId: {
12+
propDefinition: [
13+
onedrive,
14+
"fileId",
15+
],
16+
description: "The file to retrieve. You can either search for the file here, provide a custom *File ID*.",
17+
},
18+
},
19+
async run({ $ }) {
20+
const response = await this.onedrive.client().api(`/me/drive/items/${this.fileId}`)
21+
.get();
22+
$.export("$summary", `Successfully retreived file with ID: ${this.fileId}`);
23+
return response;
24+
},
25+
};

components/microsoft_onedrive/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/microsoft_onedrive",
3-
"version": "1.5.2",
3+
"version": "1.6.0",
44
"description": "Pipedream Microsoft OneDrive components",
55
"main": "microsoft_onedrive.app.js",
66
"homepage": "https://pipedream.com/apps/microsoft-onedrive",
@@ -10,7 +10,7 @@
1010
},
1111
"dependencies": {
1212
"@microsoft/microsoft-graph-client": "^3.0.1",
13-
"@pipedream/platform": "^1.1.0",
13+
"@pipedream/platform": "^3.0.3",
1414
"bottleneck": "^2.19.5",
1515
"file-type": "^18.7.0",
1616
"isomorphic-fetch": "^3.0.0",
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
};

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.7",
6+
version: "0.0.8",
77
name: "Create Contact",
88
description: "Add a contact to the root Contacts folder, [See the docs](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.7",
6+
version: "0.0.8",
77
name: "Create Draft Email",
88
description: "Create a draft email, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-post-messages)",
99
props: {

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.7",
6+
version: "0.0.8",
77
name: "Find Contacts",
88
description: "Finds contacts with given search string",
99
props: {

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.7",
6+
version: "0.0.8",
77
name: "List Contacts",
88
description: "Get a contact collection from the default contacts folder, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-list-contacts)",
99
props: {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
};
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
};

components/microsoft_outlook/actions/send-email/send-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-send-email",
6-
version: "0.0.8",
6+
version: "0.0.9",
77
name: "Send Email",
88
description: "Send an email to one or multiple recipients, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-sendmail)",
99
props: {

0 commit comments

Comments
 (0)