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
@@ -0,0 +1,25 @@
import onedrive from "../../microsoft_onedrive.app.mjs";

export default {
key: "microsoft_onedrive-get-file-by-id",
name: "Get File by ID",
description: "Retrieves a file by ID. [See the documentation](https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_get)",
version: "0.0.1",
type: "action",
props: {
onedrive,
fileId: {
propDefinition: [
onedrive,
"fileId",
],
description: "The file to retrieve. You can either search for the file here, provide a custom *File ID*.",
},
},
async run({ $ }) {
const response = await this.onedrive.client().api(`/me/drive/items/${this.fileId}`)
.get();
$.export("$summary", `Successfully retreived file with ID: ${this.fileId}`);
return response;
},
};
4 changes: 2 additions & 2 deletions components/microsoft_onedrive/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/microsoft_onedrive",
"version": "1.5.2",
"version": "1.6.0",
"description": "Pipedream Microsoft OneDrive components",
"main": "microsoft_onedrive.app.js",
"homepage": "https://pipedream.com/apps/microsoft-onedrive",
Expand All @@ -10,7 +10,7 @@
},
"dependencies": {
"@microsoft/microsoft-graph-client": "^3.0.1",
"@pipedream/platform": "^1.1.0",
"@pipedream/platform": "^3.0.3",
"bottleneck": "^2.19.5",
"file-type": "^18.7.0",
"isomorphic-fetch": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import microsoftOutlook from "../../microsoft_outlook.app.mjs";

export default {
key: "microsoft_outlook-add-label-to-email",
name: "Add Label to Email",
description: "Adds a label/category to an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/message-update)",
version: "0.0.1",
type: "action",
props: {
microsoftOutlook,
messageId: {
propDefinition: [
microsoftOutlook,
"messageId",
],
},
labelId: {
propDefinition: [
microsoftOutlook,
"labelId",
],
},
},
async run({ $ }) {
const message = await this.microsoftOutlook.getMessage({
$,
messageId: this.messageId,
});

const labels = message?.categories;

const response = await this.microsoftOutlook.updateMessage({
$,
messageId: this.messageId,
data: {
categories: [
...labels,
this.labelId,
],
},
});
$.export("$summary", "Successfully added label to message.");
return response;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
export default {
type: "action",
key: "microsoft_outlook-create-contact",
version: "0.0.7",
version: "0.0.8",
name: "Create Contact",
description: "Add a contact to the root Contacts folder, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-post-contacts)",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
export default {
type: "action",
key: "microsoft_outlook-create-draft-email",
version: "0.0.7",
version: "0.0.8",
name: "Create Draft Email",
description: "Create a draft email, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-post-messages)",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
export default {
type: "action",
key: "microsoft_outlook-find-contacts",
version: "0.0.7",
version: "0.0.8",
name: "Find Contacts",
description: "Finds contacts with given search string",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
export default {
type: "action",
key: "microsoft_outlook-list-contacts",
version: "0.0.7",
version: "0.0.8",
name: "List Contacts",
description: "Get a contact collection from the default contacts folder, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-list-contacts)",
props: {
Expand Down
21 changes: 21 additions & 0 deletions components/microsoft_outlook/actions/list-labels/list-labels.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import microsoftOutlook from "../../microsoft_outlook.app.mjs";

export default {
key: "microsoft_outlook-list-labels",
name: "List Labels",
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)",
version: "0.0.1",
type: "action",
props: {
microsoftOutlook,
},
async run({ $ }) {
const { value } = await this.microsoftOutlook.listLabels({
$,
});
$.export("$summary", `Successfully retrieved ${value.length} label${value.length != 1
? "s"
: ""}.`);
return value;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import microsoftOutlook from "../../microsoft_outlook.app.mjs";

export default {
key: "microsoft_outlook-remove-label-from-email",
name: "Remove Label from Email",
description: "Removes a label/category from an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/message-update)",
version: "0.0.1",
type: "action",
props: {
microsoftOutlook,
messageId: {
propDefinition: [
microsoftOutlook,
"messageId",
],
},
labelId: {
propDefinition: [
microsoftOutlook,
"labelId",
],
description: "The identifier of the label/category to remove",
},
},
async run({ $ }) {
const message = await this.microsoftOutlook.getMessage({
$,
messageId: this.messageId,
});
let labels = message?.categories;

const index = labels.indexOf(this.labelId);
if (index > -1) {
labels.splice(index, 1);
}

const response = await this.microsoftOutlook.updateMessage({
$,
messageId: this.messageId,
data: {
categories: labels,
},
});
$.export("$summary", "Successfully removed label from message.");
return response;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
export default {
type: "action",
key: "microsoft_outlook-send-email",
version: "0.0.8",
version: "0.0.9",
name: "Send Email",
description: "Send an email to one or multiple recipients, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-sendmail)",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
export default {
type: "action",
key: "microsoft_outlook-update-contact",
version: "0.0.7",
version: "0.0.8",
name: "Update Contact",
description: "Add a contact to the root Contacts folder, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-post-contacts)",
props: {
Expand Down
50 changes: 50 additions & 0 deletions components/microsoft_outlook/microsoft_outlook.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,41 @@ export default {
type: "object",
optional: true,
},
labelId: {
type: "string",
label: "Label ID",
description: "The identifier of the label/category to add",
async options() {
const { value: labels } = await this.listLabels();
return labels?.map(({
id: value, displayName: label,
}) => ({
value,
label,
})) || [];
},
},
messageId: {
type: "string",
label: "Message ID",
description: "The identifier of the message to update",
async options({ page }) {
const limit = 50;
const { value } = await this.listMessages({
params: {
$top: limit,
$skip: limit * page,
$orderby: "createdDateTime desc",
},
});
return value?.map(({
id: value, subject: label,
}) => ({
value,
label,
})) || [];
},
},
},
methods: {
_getUrl(path) {
Expand Down Expand Up @@ -286,5 +321,20 @@ export default {
...args,
});
},
listLabels(args = {}) {
return this._makeRequest({
path: "/me/outlook/masterCategories",
...args,
});
},
updateMessage({
messageId, ...args
}) {
return this._makeRequest({
method: "PATCH",
path: `/me/messages/${messageId}`,
...args,
});
},
},
};
3 changes: 2 additions & 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.0.5",
"version": "1.1.0",
"description": "Pipedream Microsoft Outlook Components",
"main": "microsoft_outlook.app.mjs",
"keywords": [
Expand All @@ -12,6 +12,7 @@
"homepage": "https://pipedream.com/apps/microsoft_outlook",
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"dependencies": {
"@pipedream/platform": "^3.0.3",
"axios": "^0.21.1",
"js-base64": "^3.7.2",
"md5": "^2.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "microsoft_outlook-new-contact",
name: "New Contact Event (Instant)",
description: "Emit new event when a new Contact is created",
version: "0.0.8",
version: "0.0.9",
type: "source",
hooks: {
...common.hooks,
Expand Down
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.11",
version: "0.0.12",
type: "source",
dedupe: "unique",
props: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import microsoftOutlook from "../../microsoft_outlook_calendar.app.mjs";

export default {
key: "microsoft_outlook_calendar-get-schedule",
name: "Get Free/Busy Schedule",
description: "Get the free/busy availability information for a collection of users, distributions lists, or resources (rooms or equipment) for a specified time period. [See the documentation](https://learn.microsoft.com/en-us/graph/api/calendar-getschedule)",
version: "0.0.1",
type: "action",
props: {
microsoftOutlook,
schedules: {
type: "string[]",
label: "Schedules",
description: "A collection of SMTP addresses of users, distribution lists, or resources to get availability information for",
},
start: {
propDefinition: [
microsoftOutlook,
"start",
],
},
end: {
propDefinition: [
microsoftOutlook,
"end",
],
},
timeZone: {
propDefinition: [
microsoftOutlook,
"timeZone",
],
},
availabilityViewInterval: {
type: "integer",
label: "Availability View Interval",
description: "Represents the duration of a time slot in minutes in an availabilityView in the response. The default is 30 minutes, minimum is 5, maximum is 1440.",
optional: true,
},
},
methods: {
getSchedule(opts = {}) {
return this.microsoftOutlook._makeRequest({
method: "POST",
path: "/me/calendar/getSchedule",
...opts,
});
},
},
async run({ $ }) {
const { value } = await this.getSchedule({
$,
data: {
schedules: this.schedules,
startTime: {
dateTime: this.start,
timeZone: this.timeZone,
},
endTime: {
dateTime: this.end,
timeZone: this.timeZone,
},
availabilityViewInterval: this.availabilityViewInterval,
},
});

$.export("$summary", `Successfully retrieved schedules for \`${this.schedules.join("`, `")}\``);

return value;
},
};
Loading
Loading