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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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.4",
version: "0.0.5",
type: "action",
props: {
microsoftOutlook,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "microsoft_outlook-approve-workflow",
name: "Approve Workflow",
description: "Suspend the workflow until approved by email. [See the documentation](https://pipedream.com/docs/code/nodejs/rerun#flowsuspend)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
microsoftOutlook,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
export default {
type: "action",
key: "microsoft_outlook-create-contact",
version: "0.0.11",
version: "0.0.12",
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)",
description: "Add a contact to the root Contacts folder, [See the documentation](https://docs.microsoft.com/en-us/graph/api/user-post-contacts)",
props: {
microsoftOutlook,
givenName: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
export default {
type: "action",
key: "microsoft_outlook-create-draft-email",
version: "0.0.11",
version: "0.0.12",
name: "Create Draft Email",
description: "Create a draft email, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-post-messages)",
description: "Create a draft email, [See the documentation](https://docs.microsoft.com/en-us/graph/api/user-post-messages)",
props: {
microsoftOutlook,
recipients: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,50 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
export default {
type: "action",
key: "microsoft_outlook-find-contacts",
version: "0.0.11",
version: "0.0.12",
name: "Find Contacts",
description: "Finds contacts with given search string",
description: "Finds contacts with the given search string. [See the documentation](https://docs.microsoft.com/en-us/graph/api/user-list-contacts)",
props: {
microsoftOutlook,
searchString: {
label: "Search string",
description: "Provide email address, given name, surname or display name (case sensitive)",
type: "string",
},
maxResults: {
propDefinition: [
microsoftOutlook,
"maxResults",
],
},
},
async run({ $ }) {
const contactList = await this.microsoftOutlook.listContacts({
$,
});
const relatedContacts = contactList.value.filter((c) => {
return c.displayName.includes(this.searchString) ||
c.givenName.includes(this.searchString) ||
c.surname.includes(this.searchString) ||
c.emailAddresses.find((e) =>
e.address == this.searchString ||
e.name.includes(this.searchString));
const contacts = this.microsoftOutlook.paginate({
fn: this.microsoftOutlook.listContacts,
args: {
$,
},
});

const relatedContacts = [];
for await (const contact of contacts) {
if (
contact.displayName.includes(this.searchString) ||
contact.givenName.includes(this.searchString) ||
contact.surname.includes(this.searchString) ||
contact.emailAddresses.find(
(e) => e.address == this.searchString || e.name.includes(this.searchString),
)
) {
relatedContacts.push(contact);
if (this.maxResults && relatedContacts.length >= this.maxResults) {
break;
}
}
}

// eslint-disable-next-line multiline-ternary
$.export("$summary", `${relatedContacts.length} contact${relatedContacts.length != 1 ? "s" : ""} has been filtered.`);
$.export("$summary", `${relatedContacts.length} matching contact${relatedContacts.length != 1 ? "s" : ""} found`);
return relatedContacts;
},
};
33 changes: 21 additions & 12 deletions components/microsoft_outlook/actions/find-email/find-email.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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.2",
version: "0.0.3",
type: "action",
props: {
microsoftOutlook,
Expand All @@ -15,23 +15,32 @@ export default {
optional: true,
},
maxResults: {
type: "integer",
label: "Max Results",
description: "The maximum number of results to return",
optional: true,
propDefinition: [
microsoftOutlook,
"maxResults",
],
},
},
async run({ $ }) {
const { value } = await this.microsoftOutlook.listMessages({
$,
params: {
"$filter": this.filter,
"$top": this.maxResults,
const items = this.microsoftOutlook.paginate({
fn: this.microsoftOutlook.listMessages,
args: {
$,
params: {
"$filter": this.filter,
},
},
max: this.maxResults,
});
$.export("$summary", `Successfully retrieved ${value.length} message${value.length != 1

const emails = [];
for await (const item of items) {
emails.push(item);
}

$.export("$summary", `Successfully retrieved ${emails.length} message${emails.length != 1
? "s"
: ""}.`);
return value;
return emails;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,41 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
export default {
type: "action",
key: "microsoft_outlook-list-contacts",
version: "0.0.11",
version: "0.0.12",
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)",
description: "Get a contact collection from the default contacts folder, [See the documentation](https://docs.microsoft.com/en-us/graph/api/user-list-contacts)",
props: {
microsoftOutlook,
filterAddress: {
label: "Email adress",
label: "Email Address",
description: "If this is given, only contacts with the given address will be retrieved.",
type: "string",
optional: true,
},
maxResults: {
propDefinition: [
microsoftOutlook,
"maxResults",
],
},
},
async run({ $ }) {
const response = await this.microsoftOutlook.listContacts({
$,
filterAddress: this.filterAddress,
const items = this.microsoftOutlook.paginate({
fn: this.microsoftOutlook.listContacts,
args: {
$,
filterAddress: this.filterAddress,
},
max: this.maxResults,
});

const contacts = [];
for await (const item of items) {
contacts.push(item);
}

// eslint-disable-next-line multiline-ternary
$.export("$summary", `${response.value.length} contact${response.value.length != 1 ? "s" : ""} has been retrieved.`);
return response.value;
$.export("$summary", `${contacts.length} contact${contacts.length != 1 ? "s" : ""} retrieved.`);
return contacts;
},
};
26 changes: 21 additions & 5 deletions components/microsoft_outlook/actions/list-folders/list-folders.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,34 @@ 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.2",
version: "0.0.3",
type: "action",
props: {
microsoftOutlook,
maxResults: {
propDefinition: [
microsoftOutlook,
"maxResults",
],
},
},
async run({ $ }) {
const { value } = await this.microsoftOutlook.listFolders({
$,
const items = this.microsoftOutlook.paginate({
fn: this.microsoftOutlook.listFolders,
args: {
$,
},
max: this.maxResults,
});
$.export("$summary", `Successfully retrieved ${value.length} folder${value.length != 1

const folders = [];
for await (const item of items) {
folders.push(item);
}

$.export("$summary", `Successfully retrieved ${folders.length} folder${folders.length != 1
? "s"
: ""}.`);
return value;
return folders;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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.4",
version: "0.0.5",
type: "action",
props: {
microsoftOutlook,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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.2",
version: "0.0.3",
type: "action",
props: {
microsoftOutlook,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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.4",
version: "0.0.5",
type: "action",
props: {
microsoftOutlook,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "microsoft_outlook-reply-to-email",
name: "Reply to Email",
description: "Reply to an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/message-reply)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
microsoftOutlook,
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-send-email",
version: "0.0.12",
version: "0.0.13",
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.11",
version: "0.0.12",
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
Loading
Loading