codeapp-js 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/codeApp/.power/schemas/appschemas/dataSourcesInfo.ts +6275 -0
  2. package/codeApp/.power/schemas/jira/jira.Schema.json +6903 -0
  3. package/codeApp/.power/schemas/keyvault/keyvault.Schema.json +1600 -0
  4. package/codeApp/.power/schemas/teams/teams.Schema.json +11112 -0
  5. package/codeApp/dist/codeapp.js +992 -4
  6. package/codeApp/dist/power-apps-data.js +145 -31
  7. package/codeApp/src/generated/index.ts +12 -0
  8. package/codeApp/src/generated/models/AzureKeyVaultModel.ts +107 -0
  9. package/codeApp/src/generated/models/JiraModel.ts +501 -0
  10. package/codeApp/src/generated/models/Office365GroupsModel.ts +363 -0
  11. package/codeApp/src/generated/models/Office365OutlookModel.ts +2046 -0
  12. package/codeApp/src/generated/models/Office365UsersModel.ts +254 -0
  13. package/codeApp/src/generated/services/AzureKeyVaultService.ts +257 -0
  14. package/codeApp/src/generated/services/JiraService.ts +1124 -0
  15. package/codeApp/src/generated/services/Office365GroupsService.ts +326 -0
  16. package/codeApp/src/generated/services/Office365OutlookService.ts +2476 -0
  17. package/codeApp/src/generated/services/Office365UsersService.ts +358 -0
  18. package/dev files/outlook.js +218 -9
  19. package/examples/combined demo/dist/codeapp.js +1098 -1098
  20. package/examples/combined demo/dist/index.js +470 -470
  21. package/examples/combined demo/dist/power-apps-data.js +3006 -3006
  22. package/examples/combined demo/power.config.json +42 -42
  23. package/examples/dataverse Demo/dist/codeapp.js +1085 -1085
  24. package/examples/dataverse Demo/dist/index.html +54 -54
  25. package/examples/dataverse Demo/dist/index.js +82 -82
  26. package/examples/dataverse Demo/dist/power-apps-data.js +2911 -2911
  27. package/examples/dataverse Demo/power.config.json +34 -34
  28. package/examples/dataverse Demo/readme.md +79 -79
  29. package/examples/groups Demo/dist/codeapp.js +1085 -1085
  30. package/examples/groups Demo/dist/index.js +113 -113
  31. package/examples/groups Demo/dist/power-apps-data.js +2911 -2911
  32. package/examples/kanban/dist/dataverse.js +94 -94
  33. package/examples/kanban/dist/environmentVar.js +55 -55
  34. package/examples/kanban/dist/office365groups.js +97 -97
  35. package/examples/kanban/dist/office365users.js +169 -169
  36. package/examples/kanban/dist/outlook.js +162 -162
  37. package/examples/kanban/dist/power-apps-data.js +2953 -2953
  38. package/examples/kanban/dist/sharepoint.js +339 -339
  39. package/examples/myProfile/dist/index.html +184 -184
  40. package/examples/myProfile/dist/index.js +141 -141
  41. package/examples/myProfile/dist/office365users.js +169 -169
  42. package/examples/myProfile/dist/power-apps-data.js +2953 -2953
  43. package/examples/myProfile/power.config.json +22 -22
  44. package/examples/myProfile/readme.md +79 -79
  45. package/examples/outlook Demo/dist/codeapp.js +1085 -1085
  46. package/examples/outlook Demo/dist/index.html +35 -35
  47. package/examples/outlook Demo/dist/index.js +170 -170
  48. package/examples/outlook Demo/dist/outlook.js +121 -121
  49. package/examples/outlook Demo/dist/power-apps-data.js +2911 -2911
  50. package/examples/outlook Demo/dist/styles.css +84 -84
  51. package/examples/outlook Demo/readme.md +82 -82
  52. package/examples/outlook Demo2/OutlookDemo_1_0_0_1.zip +0 -0
  53. package/examples/outlook Demo2/agent/decision-log.md +7 -0
  54. package/examples/{solution explorer → outlook Demo2}/dist/codeapp.js +245 -9
  55. package/examples/outlook Demo2/dist/index.html +98 -0
  56. package/examples/outlook Demo2/dist/index.js +272 -0
  57. package/examples/outlook Demo2/dist/styles.css +639 -0
  58. package/examples/outlook Demo2/power.config.json +23 -0
  59. package/examples/outlook Demo2/src/generated/index.ts +14 -0
  60. package/examples/outlook Demo2/src/generated/models/Office365GroupsModel.ts +363 -0
  61. package/examples/outlook Demo2/src/generated/models/Office365OutlookModel.ts +2046 -0
  62. package/examples/outlook Demo2/src/generated/models/Office365UsersModel.ts +254 -0
  63. package/examples/outlook Demo2/src/generated/services/Office365GroupsService.ts +326 -0
  64. package/examples/outlook Demo2/src/generated/services/Office365OutlookService.ts +2476 -0
  65. package/examples/outlook Demo2/src/generated/services/Office365UsersService.ts +358 -0
  66. package/examples/planning Poker/.vscode/settings.json +4 -4
  67. package/examples/planning Poker/additional files/customizations (tables).xml +6428 -6428
  68. package/examples/planning Poker/additional files/dataverse-tables.json +165 -165
  69. package/examples/planning Poker/additional files/readme.md +122 -122
  70. package/examples/planning Poker/dist/dataverse.js +78 -78
  71. package/examples/planning Poker/dist/index.html +198 -198
  72. package/examples/planning Poker/dist/index.js +954 -954
  73. package/examples/planning Poker/dist/power-apps-data.js +2953 -2953
  74. package/examples/planning Poker/dist/styles.css +815 -815
  75. package/examples/sharePoint Demo/agent/decision-log.md +5 -5
  76. package/examples/sharePoint Demo/dist/codeapp.js +1085 -1085
  77. package/examples/sharePoint Demo/dist/index.js +262 -262
  78. package/examples/sharePoint Demo/dist/power-apps-data.js +2911 -2911
  79. package/examples/sharePoint Demo/power.config.json +22 -22
  80. package/examples/todo/dist/dataverse.js +64 -64
  81. package/examples/todo/dist/index.html +75 -75
  82. package/examples/todo/dist/index.js +8 -8
  83. package/examples/todo/dist/power-apps-data.js +2953 -2953
  84. package/examples/todo/dist/renderer.js +375 -375
  85. package/examples/todo/dist/styles.css +691 -691
  86. package/examples/todo/power.config.json +34 -34
  87. package/package.json +1 -1
  88. package/readme.md +33 -4
  89. package/examples/solution explorer/agent/decision-log.md +0 -27
  90. package/examples/solution explorer/agent/mockup-01-swiss-grid.html +0 -452
  91. package/examples/solution explorer/agent/mockup-02-dark-glass.html +0 -496
  92. package/examples/solution explorer/agent/mockup-03-paper-console.html +0 -510
  93. package/examples/solution explorer/agent/mockup-04-neon-noir.html +0 -546
  94. package/examples/solution explorer/agent/mockup-05-zen-garden.html +0 -534
  95. package/examples/solution explorer/dist/index.html +0 -80
  96. package/examples/solution explorer/dist/index.js +0 -735
  97. package/examples/solution explorer/dist/styles.css +0 -571
  98. package/examples/solution explorer/power.config.json +0 -151
  99. /package/examples/{solution explorer → outlook Demo2}/dist/icon-512.png +0 -0
  100. /package/examples/{solution explorer → outlook Demo2}/dist/power-apps-data.js +0 -0
@@ -0,0 +1,358 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ * This file is autogenerated. Do not edit this file directly.
4
+ */
5
+
6
+ import type { ClientPhotoMetadata } from '../models/Office365UsersModel';
7
+ import type { EntityListResponse_IReadOnlyList_User } from '../models/Office365UsersModel';
8
+ import type { GraphTrending } from '../models/Office365UsersModel';
9
+ import type { GraphUserUpdateable_V1 } from '../models/Office365UsersModel';
10
+ import type { GraphUser_V1 } from '../models/Office365UsersModel';
11
+ import type { IOperationResult } from '@microsoft/power-apps/data';
12
+ import type { LinklessEntityListResponse_List_Person } from '../models/Office365UsersModel';
13
+ import type { ObjectWithoutType } from '../models/Office365UsersModel';
14
+ import type { User } from '../models/Office365UsersModel';
15
+ import { dataSourcesInfo } from '../../../.power/schemas/appschemas/dataSourcesInfo';
16
+ import { getClient } from '@microsoft/power-apps/data';
17
+
18
+ export class Office365UsersService {
19
+ private static readonly dataSourceName = 'office365users';
20
+
21
+ private static readonly client = getClient(dataSourcesInfo);
22
+
23
+ /**
24
+ * Update my profile
25
+ * Updates the profile of the current user
26
+ */
27
+ public static async UpdateMyProfile(body?: GraphUserUpdateable_V1): Promise<IOperationResult<void>> {
28
+ const params: { body?: GraphUserUpdateable_V1 } = { body };
29
+ const result = await Office365UsersService.client.executeAsync<{ body?: GraphUserUpdateable_V1 }, void>(
30
+ {
31
+ connectorOperation: {
32
+ tableName: Office365UsersService.dataSourceName,
33
+ operationName: 'UpdateMyProfile',
34
+ parameters: params
35
+ },
36
+ });
37
+ return result;
38
+ }
39
+
40
+ /**
41
+ * Get my profile (V2)
42
+ * Retrieves the profile of the current user. Learn more about available fields to select: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/user#properties
43
+ */
44
+ public static async MyProfile_V2($select?: string): Promise<IOperationResult<GraphUser_V1>> {
45
+ const params: { $select?: string } = { $select };
46
+ const result = await Office365UsersService.client.executeAsync<{ $select?: string }, GraphUser_V1>(
47
+ {
48
+ connectorOperation: {
49
+ tableName: Office365UsersService.dataSourceName,
50
+ operationName: 'MyProfile_V2',
51
+ parameters: params
52
+ },
53
+ });
54
+ return result;
55
+ }
56
+
57
+ /**
58
+ * Update my profile photo
59
+ * Updates the profile photo of the current user. The size of the photo must be less than 4 MB.
60
+ */
61
+ public static async UpdateMyPhoto(body: string, Content_Type: string): Promise<IOperationResult<void>> {
62
+ const params: { body: string, Content_Type: string } = { body, Content_Type };
63
+ const result = await Office365UsersService.client.executeAsync<{ body: string, Content_Type: string }, void>(
64
+ {
65
+ connectorOperation: {
66
+ tableName: Office365UsersService.dataSourceName,
67
+ operationName: 'UpdateMyPhoto',
68
+ parameters: params
69
+ },
70
+ });
71
+ return result;
72
+ }
73
+
74
+ /**
75
+ * Get my trending documents
76
+ * Retrieves the trending documents for the signed in user
77
+ */
78
+ public static async MyTrendingDocuments($filter?: string, extractSensitivityLabel?: boolean, fetchSensitivityLabelMetadata?: boolean): Promise<IOperationResult<{ value: GraphTrending[] }>> {
79
+ const params: { $filter?: string, extractSensitivityLabel?: boolean, fetchSensitivityLabelMetadata?: boolean } = { $filter, extractSensitivityLabel, fetchSensitivityLabelMetadata };
80
+ const result = await Office365UsersService.client.executeAsync<{ $filter?: string, extractSensitivityLabel?: boolean, fetchSensitivityLabelMetadata?: boolean }, { value: GraphTrending[] }>(
81
+ {
82
+ connectorOperation: {
83
+ tableName: Office365UsersService.dataSourceName,
84
+ operationName: 'MyTrendingDocuments',
85
+ parameters: params
86
+ },
87
+ });
88
+ return result;
89
+ }
90
+
91
+ /**
92
+ * Get relevant people
93
+ * Get relevant people.
94
+ */
95
+ public static async RelevantPeople(userId: string): Promise<IOperationResult<LinklessEntityListResponse_List_Person>> {
96
+ const params: { userId: string } = { userId };
97
+ const result = await Office365UsersService.client.executeAsync<{ userId: string }, LinklessEntityListResponse_List_Person>(
98
+ {
99
+ connectorOperation: {
100
+ tableName: Office365UsersService.dataSourceName,
101
+ operationName: 'RelevantPeople',
102
+ parameters: params
103
+ },
104
+ });
105
+ return result;
106
+ }
107
+
108
+ /**
109
+ * Get my profile (V1)
110
+ * Retrieves the profile of the current user.
111
+ */
112
+ public static async MyProfile(): Promise<IOperationResult<User>> {
113
+ const result = await Office365UsersService.client.executeAsync<void, User>(
114
+ {
115
+ connectorOperation: {
116
+ tableName: Office365UsersService.dataSourceName,
117
+ operationName: 'MyProfile',
118
+ },
119
+ });
120
+ return result;
121
+ }
122
+
123
+ /**
124
+ * Get user profile (V1)
125
+ * Retrieves the profile of a specific user.
126
+ */
127
+ public static async UserProfile(userId: string): Promise<IOperationResult<User>> {
128
+ const params: { userId: string } = { userId };
129
+ const result = await Office365UsersService.client.executeAsync<{ userId: string }, User>(
130
+ {
131
+ connectorOperation: {
132
+ tableName: Office365UsersService.dataSourceName,
133
+ operationName: 'UserProfile',
134
+ parameters: params
135
+ },
136
+ });
137
+ return result;
138
+ }
139
+
140
+ /**
141
+ * Get user photo metadata
142
+ * Get user photo metadata.
143
+ */
144
+ public static async UserPhotoMetadata(userId: string): Promise<IOperationResult<ClientPhotoMetadata>> {
145
+ const params: { userId: string } = { userId };
146
+ const result = await Office365UsersService.client.executeAsync<{ userId: string }, ClientPhotoMetadata>(
147
+ {
148
+ connectorOperation: {
149
+ tableName: Office365UsersService.dataSourceName,
150
+ operationName: 'UserPhotoMetadata',
151
+ parameters: params
152
+ },
153
+ });
154
+ return result;
155
+ }
156
+
157
+ /**
158
+ * Get user photo (V1)
159
+ * Retrieves the photo of the specified user if they have one.
160
+ */
161
+ public static async UserPhoto(userId: string): Promise<IOperationResult<string>> {
162
+ const params: { userId: string } = { userId };
163
+ const result = await Office365UsersService.client.executeAsync<{ userId: string }, string>(
164
+ {
165
+ connectorOperation: {
166
+ tableName: Office365UsersService.dataSourceName,
167
+ operationName: 'UserPhoto',
168
+ parameters: params
169
+ },
170
+ });
171
+ return result;
172
+ }
173
+
174
+ /**
175
+ * Get manager (V1)
176
+ * Retrieves the profile of the specified user's manager.
177
+ */
178
+ public static async Manager(userId: string): Promise<IOperationResult<User>> {
179
+ const params: { userId: string } = { userId };
180
+ const result = await Office365UsersService.client.executeAsync<{ userId: string }, User>(
181
+ {
182
+ connectorOperation: {
183
+ tableName: Office365UsersService.dataSourceName,
184
+ operationName: 'Manager',
185
+ parameters: params
186
+ },
187
+ });
188
+ return result;
189
+ }
190
+
191
+ /**
192
+ * Get direct reports (V1)
193
+ * Retrieves the user profiles of the specified user's direct reports.
194
+ */
195
+ public static async DirectReports(userId: string): Promise<IOperationResult<User[]>> {
196
+ const params: { userId: string } = { userId };
197
+ const result = await Office365UsersService.client.executeAsync<{ userId: string }, User[]>(
198
+ {
199
+ connectorOperation: {
200
+ tableName: Office365UsersService.dataSourceName,
201
+ operationName: 'DirectReports',
202
+ parameters: params
203
+ },
204
+ });
205
+ return result;
206
+ }
207
+
208
+ /**
209
+ * Search for users
210
+ * Retrieves the user profiles that match the search term.
211
+ */
212
+ public static async SearchUser(searchTerm?: string, top?: number): Promise<IOperationResult<User[]>> {
213
+ const params: { searchTerm?: string, top?: number } = { searchTerm, top };
214
+ const result = await Office365UsersService.client.executeAsync<{ searchTerm?: string, top?: number }, User[]>(
215
+ {
216
+ connectorOperation: {
217
+ tableName: Office365UsersService.dataSourceName,
218
+ operationName: 'SearchUser',
219
+ parameters: params
220
+ },
221
+ });
222
+ return result;
223
+ }
224
+
225
+ /**
226
+ * Search for users (V2)
227
+ * Retrieves the user profiles that match the search term (V2).
228
+ */
229
+ public static async SearchUserV2(searchTerm?: string, top?: number, isSearchTermRequired?: boolean, skipToken?: string): Promise<IOperationResult<EntityListResponse_IReadOnlyList_User>> {
230
+ const params: { searchTerm?: string, top?: number, isSearchTermRequired?: boolean, skipToken?: string } = { searchTerm, top, isSearchTermRequired, skipToken };
231
+ const result = await Office365UsersService.client.executeAsync<{ searchTerm?: string, top?: number, isSearchTermRequired?: boolean, skipToken?: string }, EntityListResponse_IReadOnlyList_User>(
232
+ {
233
+ connectorOperation: {
234
+ tableName: Office365UsersService.dataSourceName,
235
+ operationName: 'SearchUserV2',
236
+ parameters: params
237
+ },
238
+ });
239
+ return result;
240
+ }
241
+
242
+ /**
243
+ * Tests the connection
244
+ * Tests the connection.
245
+ */
246
+ public static async TestConnection(): Promise<IOperationResult<void>> {
247
+ const result = await Office365UsersService.client.executeAsync<void, void>(
248
+ {
249
+ connectorOperation: {
250
+ tableName: Office365UsersService.dataSourceName,
251
+ operationName: 'TestConnection',
252
+ },
253
+ });
254
+ return result;
255
+ }
256
+
257
+ /**
258
+ * Get user profile (V2)
259
+ * Retrieves the profile of a specific user. Learn more about available fields to select: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/user#properties
260
+ */
261
+ public static async UserProfile_V2(id: string, $select?: string): Promise<IOperationResult<GraphUser_V1>> {
262
+ const params: { id: string, $select?: string } = { id, $select };
263
+ const result = await Office365UsersService.client.executeAsync<{ id: string, $select?: string }, GraphUser_V1>(
264
+ {
265
+ connectorOperation: {
266
+ tableName: Office365UsersService.dataSourceName,
267
+ operationName: 'UserProfile_V2',
268
+ parameters: params
269
+ },
270
+ });
271
+ return result;
272
+ }
273
+
274
+ /**
275
+ * Get manager (V2)
276
+ * Retrieves the profile of the specified user's manager. Learn more about available fields to select: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/user#properties
277
+ */
278
+ public static async Manager_V2(id: string, $select?: string): Promise<IOperationResult<GraphUser_V1>> {
279
+ const params: { id: string, $select?: string } = { id, $select };
280
+ const result = await Office365UsersService.client.executeAsync<{ id: string, $select?: string }, GraphUser_V1>(
281
+ {
282
+ connectorOperation: {
283
+ tableName: Office365UsersService.dataSourceName,
284
+ operationName: 'Manager_V2',
285
+ parameters: params
286
+ },
287
+ });
288
+ return result;
289
+ }
290
+
291
+ /**
292
+ * Get direct reports (V2)
293
+ * Retrieves the user profiles of the specified user's direct reports. Learn more about available fields to select: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/user#properties
294
+ */
295
+ public static async DirectReports_V2(id: string, $select?: string, $top?: number): Promise<IOperationResult<{ value: GraphUser_V1[] }>> {
296
+ const params: { id: string, $select?: string, $top?: number } = { id, $select, $top };
297
+ const result = await Office365UsersService.client.executeAsync<{ id: string, $select?: string, $top?: number }, { value: GraphUser_V1[] }>(
298
+ {
299
+ connectorOperation: {
300
+ tableName: Office365UsersService.dataSourceName,
301
+ operationName: 'DirectReports_V2',
302
+ parameters: params
303
+ },
304
+ });
305
+ return result;
306
+ }
307
+
308
+ /**
309
+ * Get user photo (V2)
310
+ * Retrieves the photo of the specified user if they have one
311
+ */
312
+ public static async UserPhoto_V2(id: string): Promise<IOperationResult<string>> {
313
+ const params: { id: string } = { id };
314
+ const result = await Office365UsersService.client.executeAsync<{ id: string }, string>(
315
+ {
316
+ connectorOperation: {
317
+ tableName: Office365UsersService.dataSourceName,
318
+ operationName: 'UserPhoto_V2',
319
+ parameters: params
320
+ },
321
+ });
322
+ return result;
323
+ }
324
+
325
+ /**
326
+ * Get trending documents
327
+ * Retrieves the trending documents for a user
328
+ */
329
+ public static async TrendingDocuments(id: string, $filter?: string, extractSensitivityLabel?: boolean, fetchSensitivityLabelMetadata?: boolean): Promise<IOperationResult<{ value: GraphTrending[] }>> {
330
+ const params: { id: string, $filter?: string, extractSensitivityLabel?: boolean, fetchSensitivityLabelMetadata?: boolean } = { id, $filter, extractSensitivityLabel, fetchSensitivityLabelMetadata };
331
+ const result = await Office365UsersService.client.executeAsync<{ id: string, $filter?: string, extractSensitivityLabel?: boolean, fetchSensitivityLabelMetadata?: boolean }, { value: GraphTrending[] }>(
332
+ {
333
+ connectorOperation: {
334
+ tableName: Office365UsersService.dataSourceName,
335
+ operationName: 'TrendingDocuments',
336
+ parameters: params
337
+ },
338
+ });
339
+ return result;
340
+ }
341
+
342
+ /**
343
+ * Send an HTTP request
344
+ * Construct a Microsoft Graph REST API request to invoke. These segments are supported: 1st segement: /me, /users/<userId> 2nd segment: messages, mailFolders, events, calendar, calendars, outlook, inferenceClassification. Learn more: https://docs.microsoft.com/en-us/graph/use-the-api.
345
+ */
346
+ public static async HttpRequest(Uri: string, Method: string, Body?: string, ContentType?: string, CustomHeader1?: string, CustomHeader2?: string, CustomHeader3?: string, CustomHeader4?: string, CustomHeader5?: string): Promise<IOperationResult<ObjectWithoutType>> {
347
+ const params: { Uri: string, Method: string, Body?: string, ContentType?: string, CustomHeader1?: string, CustomHeader2?: string, CustomHeader3?: string, CustomHeader4?: string, CustomHeader5?: string } = { Uri, Method, Body, ContentType, CustomHeader1, CustomHeader2, CustomHeader3, CustomHeader4, CustomHeader5 };
348
+ const result = await Office365UsersService.client.executeAsync<{ Uri: string, Method: string, Body?: string, ContentType?: string, CustomHeader1?: string, CustomHeader2?: string, CustomHeader3?: string, CustomHeader4?: string, CustomHeader5?: string }, ObjectWithoutType>(
349
+ {
350
+ connectorOperation: {
351
+ tableName: Office365UsersService.dataSourceName,
352
+ operationName: 'HttpRequest',
353
+ parameters: params
354
+ },
355
+ });
356
+ return result;
357
+ }
358
+ }
@@ -3,6 +3,7 @@ import { getClient } from "./power-apps-data.js";
3
3
  // ── Data source name (must match connectionReferences in power.config.json) ──
4
4
  const DATA_SOURCE_CANDIDATES = ["office365outlook", "Office365Outlook", "office365"];
5
5
  const OUTLOOK_APIS = {
6
+ // ── Email operations ──
6
7
  GetEmailsV3: {
7
8
  path: "/{connectionId}/v3/Mail",
8
9
  method: "GET",
@@ -24,6 +25,100 @@ const OUTLOOK_APIS = {
24
25
  { name: "top", in: "query", required: false },
25
26
  ],
26
27
  },
28
+ SendEmailV2: {
29
+ path: "/{connectionId}/v2/Mail",
30
+ method: "POST",
31
+ parameters: [
32
+ { name: "connectionId", in: "path", required: true },
33
+ { name: "emailMessage", in: "body", required: true },
34
+ ],
35
+ },
36
+ ForwardEmail: {
37
+ path: "/{connectionId}/codeless/api/v2.0/me/messages/{message_id}/forward",
38
+ method: "POST",
39
+ parameters: [
40
+ { name: "connectionId", in: "path", required: true },
41
+ { name: "message_id", in: "path", required: true },
42
+ { name: "body", in: "body", required: true },
43
+ ],
44
+ },
45
+ ReplyToV3: {
46
+ path: "/{connectionId}/v3/Mail/ReplyTo/{messageId}",
47
+ method: "POST",
48
+ parameters: [
49
+ { name: "connectionId", in: "path", required: true },
50
+ { name: "messageId", in: "path", required: true },
51
+ { name: "replyParameters", in: "body", required: true },
52
+ { name: "mailboxAddress", in: "query", required: false },
53
+ ],
54
+ },
55
+ MoveV2: {
56
+ path: "/{connectionId}/v2/Mail/Move/{messageId}",
57
+ method: "POST",
58
+ parameters: [
59
+ { name: "connectionId", in: "path", required: true },
60
+ { name: "messageId", in: "path", required: true },
61
+ { name: "folderPath", in: "query", required: true },
62
+ { name: "mailboxAddress", in: "query", required: false },
63
+ ],
64
+ },
65
+ DeleteEmail: {
66
+ path: "/{connectionId}/Mail/{messageId}",
67
+ method: "DELETE",
68
+ parameters: [
69
+ { name: "connectionId", in: "path", required: true },
70
+ { name: "messageId", in: "path", required: true },
71
+ ],
72
+ },
73
+ SharedMailboxSendEmailV2: {
74
+ path: "/{connectionId}/v2/SharedMailbox/Mail",
75
+ method: "POST",
76
+ parameters: [
77
+ { name: "connectionId", in: "path", required: true },
78
+ { name: "emailMessage", in: "body", required: true },
79
+ ],
80
+ },
81
+ // ── Calendar operations ──
82
+ V4CalendarGetItems: {
83
+ path: "/{connectionId}/datasets/calendars/v4/tables/{table}/items",
84
+ method: "GET",
85
+ parameters: [
86
+ { name: "connectionId", in: "path", required: true },
87
+ { name: "table", in: "path", required: true },
88
+ { name: "$filter", in: "query", required: false },
89
+ { name: "$orderby", in: "query", required: false },
90
+ { name: "$top", in: "query", required: false },
91
+ { name: "$skip", in: "query", required: false },
92
+ ],
93
+ },
94
+ V4CalendarPostItem: {
95
+ path: "/{connectionId}/datasets/calendars/v4/tables/{table}/items",
96
+ method: "POST",
97
+ parameters: [
98
+ { name: "connectionId", in: "path", required: true },
99
+ { name: "table", in: "path", required: true },
100
+ { name: "item", in: "body", required: true },
101
+ ],
102
+ },
103
+ V4CalendarPatchItem: {
104
+ path: "/{connectionId}/datasets/calendars/v4/tables/{table}/items/{id}",
105
+ method: "PATCH",
106
+ parameters: [
107
+ { name: "connectionId", in: "path", required: true },
108
+ { name: "table", in: "path", required: true },
109
+ { name: "id", in: "path", required: true },
110
+ { name: "item", in: "body", required: true },
111
+ ],
112
+ },
113
+ CalendarDeleteItem: {
114
+ path: "/{connectionId}/datasets/calendars/tables/{table}/items/{id}",
115
+ method: "DELETE",
116
+ parameters: [
117
+ { name: "connectionId", in: "path", required: true },
118
+ { name: "table", in: "path", required: true },
119
+ { name: "id", in: "path", required: true },
120
+ ],
121
+ },
27
122
  };
28
123
 
29
124
  // ── Initialize SDK client for the Office 365 Outlook connector ──
@@ -78,7 +173,7 @@ function unwrapResult(oResult) {
78
173
  }
79
174
 
80
175
  // ── Internal: execute a connector operation ────────────────────
81
- async function execOp(operationName, parameters) {
176
+ async function execOp(sOperationName, oParameters) {
82
177
  const client = await initClient();
83
178
  const aErrors = [];
84
179
 
@@ -86,15 +181,15 @@ async function execOp(operationName, parameters) {
86
181
  const sDataSourceName = DATA_SOURCE_CANDIDATES[iIndex];
87
182
 
88
183
  try {
89
- const result = await client.executeAsync({
184
+ const oResult = await client.executeAsync({
90
185
  connectorOperation: {
91
186
  tableName: sDataSourceName,
92
- operationName,
93
- parameters,
187
+ operationName: sOperationName,
188
+ parameters: oParameters,
94
189
  },
95
190
  });
96
191
 
97
- return unwrapResult(result);
192
+ return unwrapResult(oResult);
98
193
  } catch (oErr) {
99
194
  const sMessage = stringifyErrorDetails(oErr);
100
195
  aErrors.push(sDataSourceName + ": " + sMessage);
@@ -108,14 +203,128 @@ async function execOp(operationName, parameters) {
108
203
  throw new Error("No Outlook connection reference matched. Tried: " + aErrors.join(" || "));
109
204
  }
110
205
 
206
+ // ── Generic: call any Outlook connector operation ──────────────
207
+ export async function callOutlookOperation(sOperationName, oParameters) {
208
+ return execOp(sOperationName, oParameters);
209
+ }
210
+
211
+ // ── Send Email ─────────────────────────────────────────────────
212
+ export async function sendEmail({ to, cc, bcc, subject, body, isHtml, importance, attachments } = {}) {
213
+ var oMessage = {
214
+ To: to,
215
+ Subject: subject,
216
+ Body: body,
217
+ };
218
+ if (cc) oMessage.Cc = cc;
219
+ if (bcc) oMessage.Bcc = bcc;
220
+ if (importance) oMessage.Importance = importance;
221
+ if (attachments) oMessage.Attachments = attachments;
222
+ if (isHtml === false) oMessage.IsHtml = false;
223
+
224
+ return execOp("SendEmailV2", { emailMessage: oMessage });
225
+ }
226
+
227
+ // ── Forward Email ──────────────────────────────────────────────
228
+ export async function forwardEmail(sMessageId, { to, comment } = {}) {
229
+ return execOp("ForwardEmail", {
230
+ message_id: sMessageId,
231
+ body: { ToRecipients: to, Comment: comment },
232
+ });
233
+ }
234
+
235
+ // ── Reply to Email ─────────────────────────────────────────────
236
+ export async function replyToEmail(sMessageId, { comment, replyAll } = {}) {
237
+ return execOp("ReplyToV3", {
238
+ messageId: sMessageId,
239
+ replyParameters: { Body: comment, ReplyAll: replyAll === true },
240
+ });
241
+ }
242
+
111
243
  // ── List Emails ────────────────────────────────────────────────
112
244
  export async function listEmails({ folderId = "Inbox", fetchOnlyUnread, searchQuery, top, skip } = {}) {
113
- void skip;
114
-
115
245
  return execOp("GetEmailsV3", {
116
246
  folderPath: folderId,
117
- fetchOnlyUnread,
118
- searchQuery,
247
+ fetchOnlyUnread: fetchOnlyUnread,
248
+ searchQuery: searchQuery,
119
249
  top: top != null ? top : 10,
250
+ skip: skip,
251
+ });
252
+ }
253
+
254
+ // ── Send from Shared Mailbox ───────────────────────────────────
255
+ export async function sendFromSharedMailbox(sSharedMailbox, { to, cc, bcc, subject, body, importance, attachments } = {}) {
256
+ var oMessage = {
257
+ MailboxAddress: sSharedMailbox,
258
+ To: to,
259
+ Subject: subject,
260
+ Body: body,
261
+ };
262
+ if (cc) oMessage.Cc = cc;
263
+ if (bcc) oMessage.Bcc = bcc;
264
+ if (importance) oMessage.Importance = importance;
265
+ if (attachments) oMessage.Attachments = attachments;
266
+
267
+ return execOp("SharedMailboxSendEmailV2", { emailMessage: oMessage });
268
+ }
269
+
270
+ // ── Move Email ─────────────────────────────────────────────────
271
+ export async function moveEmail(sMessageId, sDestinationFolderId) {
272
+ return execOp("MoveV2", {
273
+ messageId: sMessageId,
274
+ folderPath: sDestinationFolderId,
275
+ });
276
+ }
277
+
278
+ // ── Delete Email ───────────────────────────────────────────────
279
+ export async function deleteEmail(sMessageId) {
280
+ return execOp("DeleteEmail", { messageId: sMessageId });
281
+ }
282
+
283
+ // ── Create Event ───────────────────────────────────────────────
284
+ export async function createEvent({ subject, start, end, attendees, body, location, importance, isAllDay, timeZone, calendarId } = {}) {
285
+ var sAttendees = Array.isArray(attendees) ? attendees.join(";") : attendees;
286
+ var oItem = {
287
+ subject: subject,
288
+ start: start,
289
+ end: end,
290
+ timeZone: timeZone || "",
291
+ };
292
+ if (sAttendees) oItem.requiredAttendees = sAttendees;
293
+ if (body) oItem.body = body;
294
+ if (location) oItem.location = location;
295
+ if (importance) oItem.importance = importance;
296
+ if (isAllDay) oItem.isAllDay = true;
297
+
298
+ return execOp("V4CalendarPostItem", {
299
+ table: calendarId || "Calendar",
300
+ item: oItem,
301
+ });
302
+ }
303
+
304
+ // ── List Events ────────────────────────────────────────────────
305
+ export async function listEvents({ calendarId = "Calendar", filter, orderBy, top, skip } = {}) {
306
+ return execOp("V4CalendarGetItems", {
307
+ table: calendarId,
308
+ $filter: filter,
309
+ $orderby: orderBy,
310
+ $top: top,
311
+ $skip: skip,
312
+ });
313
+ }
314
+
315
+ // ── Edit Event ─────────────────────────────────────────────────
316
+ export async function editEvent(sEventId, oChangedFields, sCalendarId) {
317
+ return execOp("V4CalendarPatchItem", {
318
+ table: sCalendarId || "Calendar",
319
+ id: sEventId,
320
+ item: oChangedFields,
321
+ });
322
+ }
323
+
324
+ // ── Delete Event ───────────────────────────────────────────────
325
+ export async function deleteEvent(sEventId, sCalendarId) {
326
+ return execOp("CalendarDeleteItem", {
327
+ table: sCalendarId || "Calendar",
328
+ id: sEventId,
120
329
  });
121
330
  }