Skip to content

Commit 466f280

Browse files
Update microsoft_outlook.app.mjs (#19154)
* Update microsoft_outlook.app.mjs * updates * versions --------- Co-authored-by: Michelle Bergeron <[email protected]>
1 parent a1fdb8c commit 466f280

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

components/microsoft_outlook/microsoft_outlook.app.mjs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,19 @@ export default {
195195
type: "string",
196196
label: "User ID",
197197
description: "The ID of the user to get messages for",
198-
async options() {
199-
const { value: users } = await this.listUsers();
198+
useQuery: true,
199+
async options({ query }) {
200+
const args = query
201+
? {
202+
params: {
203+
$search: `"${encodeURIComponent("displayName:" + query)}" OR "${encodeURIComponent("mail:" + query)}" OR "${encodeURIComponent("userPrincipalName:" + query)}"`,
204+
},
205+
headers: {
206+
"ConsistencyLevel": "eventual",
207+
},
208+
}
209+
: {};
210+
const { value: users } = await this.listUsers(args);
200211
return users?.map(({
201212
id: value, displayName, mail,
202213
}) => ({
@@ -258,11 +269,12 @@ export default {
258269
_getUrl(path) {
259270
return `https://graph.microsoft.com/v1.0${path}`;
260271
},
261-
_getHeaders() {
272+
_getHeaders(headers) {
262273
return {
263274
"Authorization": `Bearer ${this.$auth.oauth_access_token}`,
264275
"accept": "application/json",
265276
"Content-Type": "application/json",
277+
...headers,
266278
};
267279
},
268280
async _makeRequest({

0 commit comments

Comments
 (0)