Skip to content

Commit 5dfb224

Browse files
committed
updates
1 parent 7f84b6d commit 5dfb224

File tree

3 files changed

+34
-13
lines changed

3 files changed

+34
-13
lines changed

components/microsoft_outlook/actions/find-email/find-email.mjs

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "microsoft_outlook-find-email",
55
name: "Find Email",
66
description: "Search for an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/user-list-messages)",
7-
version: "0.0.12",
7+
version: "0.0.13",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,
@@ -43,23 +43,44 @@ export default {
4343
],
4444
},
4545
},
46+
methods: {
47+
ensureQuotes(str) {
48+
str = str.trim();
49+
str = str.replace(/^['"]?/, "").replace(/['"]?$/, "");
50+
return `"${str}"`;
51+
},
52+
},
4653
async run({ $ }) {
47-
const items = this.microsoftOutlook.paginate({
48-
fn: this.microsoftOutlook.listMessages,
49-
args: {
54+
let emails = [];
55+
56+
if (!this.search) {
57+
const items = this.microsoftOutlook.paginate({
58+
fn: this.microsoftOutlook.listMessages,
59+
args: {
60+
$,
61+
params: {
62+
"$filter": this.filter,
63+
"$orderby": this.orderBy,
64+
},
65+
},
66+
max: this.maxResults,
67+
});
68+
69+
for await (const item of items) {
70+
emails.push(item);
71+
}
72+
} else {
73+
const { value } = await this.microsoftOutlook.listMessages({
5074
$,
5175
params: {
52-
"$search": this.search,
5376
"$filter": this.filter,
5477
"$orderby": this.orderBy,
78+
"$search": this.ensureQuotes(this.search),
79+
"$top": this.maxResults,
5580
},
56-
},
57-
max: this.maxResults,
58-
});
81+
});
5982

60-
const emails = [];
61-
for await (const item of items) {
62-
emails.push(item);
83+
emails = value;
6384
}
6485

6586
$.export("$summary", `Successfully retrieved ${emails.length} message${emails.length != 1

components/microsoft_outlook/microsoft_outlook.app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ export default {
238238
search: {
239239
type: "string",
240240
label: "Search",
241-
description: "Search for an email in Microsoft Outlook. Can search for specific message properties such as `to:[email protected]` or `subject:example`. If the property is excluded, the search targets the default propertes `from`, `subject`, and `body`. For example, `pizza` will search for messages with the word `pizza` in the subject, body, or from address, but `to:[email protected]` will only search for messages to `[email protected]`.",
241+
description: "Search for an email in Microsoft Outlook. Can search for specific message properties such as `\"to:[email protected]\"` or `\"subject:example\"`. If the property is excluded, the search targets the default propertes `from`, `subject`, and `body`. For example, `\"pizza\"` will search for messages with the word `pizza` in the subject, body, or from address, but `\"to:[email protected]\"` will only search for messages to `[email protected]`.",
242242
optional: true,
243243
},
244244
filter: {

components/microsoft_outlook/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/microsoft_outlook",
3-
"version": "1.7.2",
3+
"version": "1.7.3",
44
"description": "Pipedream Microsoft Outlook Components",
55
"main": "microsoft_outlook.app.mjs",
66
"keywords": [

0 commit comments

Comments
 (0)