Skip to content

Commit 04e1f70

Browse files
committed
feat(outlook-mail): request meeting-message type and expand event iCalUId
Widens the Graph mail client's $select to include meetingMessageType and meetingRequestType, and adds $expand=event($select=iCalUId) to the initial conversation and folder-page queries, so callers can detect calendar meeting messages and their event UID. Downstream consumption of these fields is left for a follow-up change.
1 parent ef3047e commit 04e1f70

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

‎connectors/outlook-mail/src/graph-mail-api.test.ts‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { describe, expect, it } from "vitest";
22
import {
33
conversationSource,
4+
GraphMailApi,
45
isConversationFlagged,
56
isConversationUnread,
67
isViaRewrittenName,
@@ -177,3 +178,38 @@ describe("small helpers", () => {
177178
expect(conversationSource("A@B.com", "c1")).toBe("outlook-mail:a@b.com:c1");
178179
});
179180
});
181+
182+
describe("GraphMailApi queries", () => {
183+
it("getConversationMessages requests meeting fields + expands event", async () => {
184+
const calls: Array<Record<string, string> | undefined> = [];
185+
const api = new GraphMailApi("tok");
186+
api.call = async (
187+
_method: string,
188+
_url: string,
189+
params?: Record<string, string>
190+
) => {
191+
calls.push(params);
192+
return { value: [] };
193+
};
194+
await api.getConversationMessages("conv-1");
195+
expect(calls[0]?.$select).toContain("meetingMessageType");
196+
expect(calls[0]?.$select).toContain("meetingRequestType");
197+
expect(calls[0]?.$expand).toBe("event($select=iCalUId)");
198+
});
199+
200+
it("getMessagesPage requests meeting fields + expands event on the non-nextLink branch", async () => {
201+
const calls: Array<Record<string, string> | undefined> = [];
202+
const api = new GraphMailApi("tok");
203+
api.call = async (
204+
_method: string,
205+
_url: string,
206+
params?: Record<string, string>
207+
) => {
208+
calls.push(params);
209+
return { value: [] };
210+
};
211+
await api.getMessagesPage({ folderId: "f-inbox" });
212+
expect(calls[0]?.$select).toContain("meetingMessageType");
213+
expect(calls[0]?.$expand).toBe("event($select=iCalUId)");
214+
});
215+
});

‎connectors/outlook-mail/src/graph-mail-api.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ export type GraphMessage = {
3939
hasAttachments?: boolean;
4040
webLink?: string;
4141
internetMessageHeaders?: GraphHeader[];
42+
"@odata.type"?: string;
43+
meetingMessageType?: string;
44+
meetingRequestType?: string;
45+
event?: { iCalUId?: string };
4246
};
4347

4448
export type GraphMailFolder = {
@@ -139,6 +143,8 @@ export const MESSAGE_SELECT = [
139143
"parentFolderId",
140144
"hasAttachments",
141145
"webLink",
146+
"meetingMessageType",
147+
"meetingRequestType",
142148
].join(",");
143149

144150
/** Upload-session chunk size: 10 × 320 KiB (Graph requires 320 KiB multiples). */
@@ -251,6 +257,7 @@ export class GraphMailApi {
251257
$top: String(args.top ?? 20),
252258
$orderby: "receivedDateTime desc",
253259
$select: MESSAGE_SELECT,
260+
$expand: "event($select=iCalUId)",
254261
};
255262
if (args.since) {
256263
params.$filter = `receivedDateTime ge ${args.since.toISOString()}`;
@@ -292,6 +299,7 @@ export class GraphMailApi {
292299
$filter: `conversationId eq ${odataQuote(conversationId)}`,
293300
$top: "100",
294301
$select: MESSAGE_SELECT,
302+
$expand: "event($select=iCalUId)",
295303
});
296304
for (let page = 0; page < 5; page++) {
297305
messages.push(...((data?.value as GraphMessage[] | undefined) ?? []));

0 commit comments

Comments
 (0)