Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
37 changes: 37 additions & 0 deletions components/microsoft_outlook/actions/find-email/find-email.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import microsoftOutlook from "../../microsoft_outlook.app.mjs";

export default {
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.1",
type: "action",
props: {
microsoftOutlook,
filter: {
type: "string",
label: "Filter",
description: "Filters results. For example, `contains(subject, 'meet for lunch?')` will include messages whose subject contains ‘meet for lunch?’. [See documentation](https://learn.microsoft.com/en-us/graph/filter-query-parameter) for the full list of operations.",
optional: true,
},
maxResults: {
type: "integer",
label: "Max Results",
description: "The maximum number of results to return",
optional: true,
},
},
async run({ $ }) {
const { value } = await this.microsoftOutlook.listMessages({
$,
params: {
"$filter": this.filter,
"$top": this.maxResults,
},
});
$.export("$summary", `Successfully retrieved ${value.length} message${value.length != 1
? "s"
: ""}.`);
return value;
},
};
21 changes: 21 additions & 0 deletions components/microsoft_outlook/actions/list-folders/list-folders.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-folders",
name: "List Folders",
description: "Retrieves a list of all folders in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/user-list-mailfolders)",
version: "0.0.1",
type: "action",
props: {
microsoftOutlook,
},
async run({ $ }) {
const { value } = await this.microsoftOutlook.listFolders({
$,
});
$.export("$summary", `Successfully retrieved ${value.length} folder${value.length != 1
? "s"
: ""}.`);
return value;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import microsoftOutlook from "../../microsoft_outlook.app.mjs";

export default {
key: "microsoft_outlook-move-email-to-folder",
name: "Move Email to Folder",
description: "Moves an email to the specified folder in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/message-move)",
version: "0.0.1",
type: "action",
props: {
microsoftOutlook,
messageId: {
propDefinition: [
microsoftOutlook,
"messageId",
],
},
folderId: {
propDefinition: [
microsoftOutlook,
"folderIds",
],
type: "string",
label: "Folder ID",
description: "The identifier of the folder to move the selected message to",
},
},
async run({ $ }) {
const response = await this.microsoftOutlook.moveMessage({
$,
messageId: this.messageId,
data: {
destinationId: this.folderId,
},
});
$.export("$summary", `Successfully moved email to folder with ID: ${this.folderId}`);
return response;
},
};
29 changes: 29 additions & 0 deletions components/microsoft_outlook/microsoft_outlook.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,20 @@ export default {
})) || [];
},
},
folderIds: {
type: "string[]",
label: "Folder IDs to Monitor",
description: "Specify the folder IDs or names in Outlook that you want to monitor for new emails. Leave empty to monitor all folders (excluding \"Sent Items\" and \"Drafts\").",
async options() {
const { value: folders } = await this.listFolders();
return folders?.map(({
id: value, displayName: label,
}) => ({
value,
label,
})) || [];
},
},
},
methods: {
_getUrl(path) {
Expand Down Expand Up @@ -335,6 +349,21 @@ export default {
...args,
});
},
listFolders(args = {}) {
return this._makeRequest({
path: "/me/mailFolders",
...args,
});
},
moveMessage({
messageId, ...args
}) {
return this._makeRequest({
method: "POST",
path: `/me/messages/${messageId}/move`,
...args,
});
},
updateMessage({
messageId, ...args
}) {
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.1.1",
"version": "1.2.0",
"description": "Pipedream Microsoft Outlook Components",
"main": "microsoft_outlook.app.mjs",
"keywords": [
Expand Down
23 changes: 5 additions & 18 deletions components/microsoft_outlook/sources/new-email/new-email.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,11 @@ export default {
props: {
...common.props,
folderIds: {
type: "string[]",
label: "Folder IDs to Monitor",
description: "Specify the folder IDs or names in Outlook that you want to monitor for new emails. Leave empty to monitor all folders (excluding \"Sent Items\" and \"Drafts\").",
propDefinition: [
common.props.microsoftOutlook,
"folderIds",
],
optional: true,
async options() {
const { value: folders } = await this.listFolders();
return folders?.map(({
id: value, displayName: label,
}) => ({
value,
label,
})) || [];
},
},
},
hooks: {
Expand Down Expand Up @@ -56,13 +48,8 @@ export default {
},
methods: {
...common.methods,
listFolders() {
return this.microsoftOutlook._makeRequest({
path: "/me/mailFolders",
});
},
async getFolderIdByName(name) {
const { value: folders } = await this.listFolders();
const { value: folders } = await this.microsoftOutlook.listFolders();
const folder = folders.find(({ displayName }) => displayName === name);
return folder?.id;
},
Expand Down
Loading