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
@@ -1,84 +1,84 @@
1
- * {
2
- box-sizing: border-box;
3
- margin: 0;
4
- padding: 0;
5
- }
6
-
7
- body {
8
- font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
9
- padding: 20px;
10
- background: #f5f5f5;
11
- color: #333;
12
- }
13
-
14
- h1 {
15
- margin-bottom: 16px;
16
- }
17
-
18
- #loading {
19
- font-size: 14px;
20
- color: #666;
21
- }
22
-
23
- #error {
24
- color: #d32f2f;
25
- font-size: 14px;
26
- margin-top: 12px;
27
- }
28
-
29
- table {
30
- width: 100%;
31
- border-collapse: collapse;
32
- background: #fff;
33
- border-radius: 4px;
34
- overflow: hidden;
35
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
36
- }
37
-
38
- th, td {
39
- text-align: left;
40
- padding: 10px 14px;
41
- border-bottom: 1px solid #eee;
42
- }
43
-
44
- th {
45
- background: #0078d4;
46
- color: #fff;
47
- font-weight: 600;
48
- }
49
-
50
- tr:last-child td {
51
- border-bottom: none;
52
- }
53
-
54
- tr:hover td {
55
- background: #f0f6ff;
56
- }
57
-
58
- @media (prefers-color-scheme: dark) {
59
- body {
60
- background: #1e1e1e;
61
- color: #e0e0e0;
62
- }
63
-
64
- table {
65
- background: #2d2d2d;
66
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
67
- }
68
-
69
- th {
70
- background: #0063b1;
71
- }
72
-
73
- td {
74
- border-bottom-color: #444;
75
- }
76
-
77
- tr:hover td {
78
- background: #383838;
79
- }
80
-
81
- #loading {
82
- color: #aaa;
83
- }
84
- }
1
+ * {
2
+ box-sizing: border-box;
3
+ margin: 0;
4
+ padding: 0;
5
+ }
6
+
7
+ body {
8
+ font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
9
+ padding: 20px;
10
+ background: #f5f5f5;
11
+ color: #333;
12
+ }
13
+
14
+ h1 {
15
+ margin-bottom: 16px;
16
+ }
17
+
18
+ #loading {
19
+ font-size: 14px;
20
+ color: #666;
21
+ }
22
+
23
+ #error {
24
+ color: #d32f2f;
25
+ font-size: 14px;
26
+ margin-top: 12px;
27
+ }
28
+
29
+ table {
30
+ width: 100%;
31
+ border-collapse: collapse;
32
+ background: #fff;
33
+ border-radius: 4px;
34
+ overflow: hidden;
35
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
36
+ }
37
+
38
+ th, td {
39
+ text-align: left;
40
+ padding: 10px 14px;
41
+ border-bottom: 1px solid #eee;
42
+ }
43
+
44
+ th {
45
+ background: #0078d4;
46
+ color: #fff;
47
+ font-weight: 600;
48
+ }
49
+
50
+ tr:last-child td {
51
+ border-bottom: none;
52
+ }
53
+
54
+ tr:hover td {
55
+ background: #f0f6ff;
56
+ }
57
+
58
+ @media (prefers-color-scheme: dark) {
59
+ body {
60
+ background: #1e1e1e;
61
+ color: #e0e0e0;
62
+ }
63
+
64
+ table {
65
+ background: #2d2d2d;
66
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
67
+ }
68
+
69
+ th {
70
+ background: #0063b1;
71
+ }
72
+
73
+ td {
74
+ border-bottom-color: #444;
75
+ }
76
+
77
+ tr:hover td {
78
+ background: #383838;
79
+ }
80
+
81
+ #loading {
82
+ color: #aaa;
83
+ }
84
+ }
@@ -1,82 +1,82 @@
1
- # Outlook Inbox Demo
2
-
3
- Demo to show how to use the Office 365 Outlook connector to list inbox emails.
4
-
5
- ---
6
-
7
- ## Prerequisites
8
-
9
- - A Power Platform environment with Code Apps enabled
10
- - VS Code
11
- - Recommend Copilot
12
-
13
- ---
14
-
15
- ## 1. Install Power Platform CLI
16
-
17
- Install the PAC CLI via npm:
18
-
19
- ```bash
20
- npm install -g microsoft.powerapps.cli
21
- ```
22
-
23
- Or install through the [Power Platform Tools VS Code extension](https://marketplace.visualstudio.com/items?itemName=microsoft-IsvExpTools.powerplatform-vscode).
24
-
25
- Verify the install:
26
-
27
- ```bash
28
- pac --version
29
- ```
30
-
31
- ---
32
-
33
- ## 2. Authenticate and Select Environment
34
-
35
- Create an auth profile and connect to your environment:
36
-
37
- ```bash
38
- # Authenticate (opens browser for interactive login)
39
- pac auth create --environment https://<yourorg>.crm.dynamics.com
40
-
41
- # List auth profiles
42
- pac auth list
43
-
44
- # Select an existing profile (if you have multiple)
45
- pac auth select --index <profile-index>
46
-
47
- # Confirm you are connected to the correct environment
48
- pac env who
49
- ```
50
-
51
- Replace `<yourorg>` with your Dataverse org name.
52
-
53
- ---
54
-
55
- ## 3. Add the Outlook Skill File to VS Code
56
-
57
- This repo includes a skill file that gives Copilot the knowledge to build Outlook code apps:
58
-
59
- 1. Copy the `Skills/outlookCodeApp/SKILL.md` file to your VS Code Copilot skills directory:
60
- ```
61
- ~/.copilot/skills/outlookCodeApp/SKILL.md
62
- ```
63
-
64
- Once in place, Copilot will automatically use this skill when you ask it to build the code app.
65
-
66
- ---
67
-
68
- ## 4. Setup
69
-
70
- Copy the contents of `dist copy` into a `dist` folder, then copy the `index.html` and `index.js` from this examples folder into `dist`, replacing the defaults.
71
-
72
- ---
73
-
74
- ## 5. Deploy the App
75
-
76
- Update the power.config.json file with the target environment's id (it should be the same environment you have used in CLI auth).
77
-
78
- ```bash
79
- pac code push --solutionName OutlookInbox
80
- ```
81
-
82
- This packages the build output from `./dist` and deploys it as a code component inside the specified solution.
1
+ # Outlook Inbox Demo
2
+
3
+ Demo to show how to use the Office 365 Outlook connector to list inbox emails.
4
+
5
+ ---
6
+
7
+ ## Prerequisites
8
+
9
+ - A Power Platform environment with Code Apps enabled
10
+ - VS Code
11
+ - Recommend Copilot
12
+
13
+ ---
14
+
15
+ ## 1. Install Power Platform CLI
16
+
17
+ Install the PAC CLI via npm:
18
+
19
+ ```bash
20
+ npm install -g microsoft.powerapps.cli
21
+ ```
22
+
23
+ Or install through the [Power Platform Tools VS Code extension](https://marketplace.visualstudio.com/items?itemName=microsoft-IsvExpTools.powerplatform-vscode).
24
+
25
+ Verify the install:
26
+
27
+ ```bash
28
+ pac --version
29
+ ```
30
+
31
+ ---
32
+
33
+ ## 2. Authenticate and Select Environment
34
+
35
+ Create an auth profile and connect to your environment:
36
+
37
+ ```bash
38
+ # Authenticate (opens browser for interactive login)
39
+ pac auth create --environment https://<yourorg>.crm.dynamics.com
40
+
41
+ # List auth profiles
42
+ pac auth list
43
+
44
+ # Select an existing profile (if you have multiple)
45
+ pac auth select --index <profile-index>
46
+
47
+ # Confirm you are connected to the correct environment
48
+ pac env who
49
+ ```
50
+
51
+ Replace `<yourorg>` with your Dataverse org name.
52
+
53
+ ---
54
+
55
+ ## 3. Add the Outlook Skill File to VS Code
56
+
57
+ This repo includes a skill file that gives Copilot the knowledge to build Outlook code apps:
58
+
59
+ 1. Copy the `Skills/outlookCodeApp/SKILL.md` file to your VS Code Copilot skills directory:
60
+ ```
61
+ ~/.copilot/skills/outlookCodeApp/SKILL.md
62
+ ```
63
+
64
+ Once in place, Copilot will automatically use this skill when you ask it to build the code app.
65
+
66
+ ---
67
+
68
+ ## 4. Setup
69
+
70
+ Copy the contents of `dist copy` into a `dist` folder, then copy the `index.html` and `index.js` from this examples folder into `dist`, replacing the defaults.
71
+
72
+ ---
73
+
74
+ ## 5. Deploy the App
75
+
76
+ Update the power.config.json file with the target environment's id (it should be the same environment you have used in CLI auth).
77
+
78
+ ```bash
79
+ pac code push --solutionName OutlookInbox
80
+ ```
81
+
82
+ This packages the build output from `./dist` and deploys it as a code component inside the specified solution.
@@ -0,0 +1,7 @@
1
+
2
+ - Outlook inbox + send email app built with shared_office365 connector
3
+ - Single shared client pattern per connections skill; DATA_SOURCE = 'office365'
4
+ - power.config.json updated with office365 connectionReference
5
+ - Operations used: GetEmailsV3 (list inbox), SendEmailV2 (send email)
6
+ - CSS in separate dist/styles.css; editorial warm-tone design with Playfair Display + DM Sans
7
+ - User still needs to: click Sync Connections button, then Deploy to push to environment
@@ -1,4 +1,4 @@
1
- import { getClient, callActionAsync } from "./power-apps-data.js";
1
+ import { getClient, getContext, callActionAsync } from "./power-apps-data.js";
2
2
 
3
3
  // ── Initialize SDK & Client ────────────────────────────────────
4
4
  let oSharedClient = null;
@@ -68,6 +68,7 @@ function _dbgWrap(sName, aArgs, fnBody) {
68
68
  _dbgRenderEntry(oEntry, false);
69
69
  return oResult;
70
70
  }
71
+
71
72
  function _dbgClone(oVal) {
72
73
  try { return JSON.parse(JSON.stringify(oVal)); }
73
74
  catch (oErr) { return String(oVal); }
@@ -308,6 +309,9 @@ export async function deleteItem(tableName, primaryKey, id) {
308
309
  }
309
310
 
310
311
  // ── Unbound Action ─────────────────────────────────────────────
312
+ // Calls an unbound Dataverse action by POSTing to the action endpoint.
313
+ // Do NOT add action names to power.config.json dataSources — they are
314
+ // not entities and will cause deploy errors.
311
315
  export async function callUnboundAction(tableName, primaryKey, actionName, params) {
312
316
  return _dbgWrap('callUnboundAction', [tableName, primaryKey, actionName, params], async function() {
313
317
  var oAllSources = Object.assign({}, oInitialDataSources, oDataSources);
@@ -319,10 +323,11 @@ export async function callUnboundAction(tableName, primaryKey, actionName, param
319
323
  // ── WhoAmI ─────────────────────────────────────────────────────
320
324
  export async function whoAmI() {
321
325
  return _dbgWrap('whoAmI', [], async function() {
322
- var oAllSources = Object.assign({}, oInitialDataSources, oDataSources);
323
- var result = await callActionAsync(oAllSources, 'WhoAmI', {});
324
- var data = unwrapResult(result);
325
- return data.UserId || data.userid || data.systemuserid || data;
326
+ var oCtx = await getContext();
327
+ var sId = oCtx.UserId || oCtx.userId || oCtx.systemuserid;
328
+ if (sId) return sId;
329
+ if (oCtx.userSettings && oCtx.userSettings.userId) return oCtx.userSettings.userId;
330
+ return oCtx;
326
331
  });
327
332
  }
328
333
 
@@ -713,6 +718,7 @@ export async function getFileMetadata(sSiteUrl, sFileId) {
713
718
  // ── Data source name (must match connectionReferences in power.config.json) ──
714
719
  const DATA_SOURCE_CANDIDATES = ["office365outlook", "Office365Outlook", "office365"];
715
720
  const OUTLOOK_APIS = {
721
+ // ── Email operations ──
716
722
  GetEmailsV3: {
717
723
  path: "/{connectionId}/v3/Mail",
718
724
  method: "GET",
@@ -734,6 +740,100 @@ const OUTLOOK_APIS = {
734
740
  { name: "top", in: "query", required: false },
735
741
  ],
736
742
  },
743
+ SendEmailV2: {
744
+ path: "/{connectionId}/v2/Mail",
745
+ method: "POST",
746
+ parameters: [
747
+ { name: "connectionId", in: "path", required: true },
748
+ { name: "emailMessage", in: "body", required: true },
749
+ ],
750
+ },
751
+ ForwardEmail: {
752
+ path: "/{connectionId}/codeless/api/v2.0/me/messages/{message_id}/forward",
753
+ method: "POST",
754
+ parameters: [
755
+ { name: "connectionId", in: "path", required: true },
756
+ { name: "message_id", in: "path", required: true },
757
+ { name: "body", in: "body", required: true },
758
+ ],
759
+ },
760
+ ReplyToV3: {
761
+ path: "/{connectionId}/v3/Mail/ReplyTo/{messageId}",
762
+ method: "POST",
763
+ parameters: [
764
+ { name: "connectionId", in: "path", required: true },
765
+ { name: "messageId", in: "path", required: true },
766
+ { name: "replyParameters", in: "body", required: true },
767
+ { name: "mailboxAddress", in: "query", required: false },
768
+ ],
769
+ },
770
+ MoveV2: {
771
+ path: "/{connectionId}/v2/Mail/Move/{messageId}",
772
+ method: "POST",
773
+ parameters: [
774
+ { name: "connectionId", in: "path", required: true },
775
+ { name: "messageId", in: "path", required: true },
776
+ { name: "folderPath", in: "query", required: true },
777
+ { name: "mailboxAddress", in: "query", required: false },
778
+ ],
779
+ },
780
+ DeleteEmail: {
781
+ path: "/{connectionId}/Mail/{messageId}",
782
+ method: "DELETE",
783
+ parameters: [
784
+ { name: "connectionId", in: "path", required: true },
785
+ { name: "messageId", in: "path", required: true },
786
+ ],
787
+ },
788
+ SharedMailboxSendEmailV2: {
789
+ path: "/{connectionId}/v2/SharedMailbox/Mail",
790
+ method: "POST",
791
+ parameters: [
792
+ { name: "connectionId", in: "path", required: true },
793
+ { name: "emailMessage", in: "body", required: true },
794
+ ],
795
+ },
796
+ // ── Calendar operations ──
797
+ V4CalendarGetItems: {
798
+ path: "/{connectionId}/datasets/calendars/v4/tables/{table}/items",
799
+ method: "GET",
800
+ parameters: [
801
+ { name: "connectionId", in: "path", required: true },
802
+ { name: "table", in: "path", required: true },
803
+ { name: "$filter", in: "query", required: false },
804
+ { name: "$orderby", in: "query", required: false },
805
+ { name: "$top", in: "query", required: false },
806
+ { name: "$skip", in: "query", required: false },
807
+ ],
808
+ },
809
+ V4CalendarPostItem: {
810
+ path: "/{connectionId}/datasets/calendars/v4/tables/{table}/items",
811
+ method: "POST",
812
+ parameters: [
813
+ { name: "connectionId", in: "path", required: true },
814
+ { name: "table", in: "path", required: true },
815
+ { name: "item", in: "body", required: true },
816
+ ],
817
+ },
818
+ V4CalendarPatchItem: {
819
+ path: "/{connectionId}/datasets/calendars/v4/tables/{table}/items/{id}",
820
+ method: "PATCH",
821
+ parameters: [
822
+ { name: "connectionId", in: "path", required: true },
823
+ { name: "table", in: "path", required: true },
824
+ { name: "id", in: "path", required: true },
825
+ { name: "item", in: "body", required: true },
826
+ ],
827
+ },
828
+ CalendarDeleteItem: {
829
+ path: "/{connectionId}/datasets/calendars/tables/{table}/items/{id}",
830
+ method: "DELETE",
831
+ parameters: [
832
+ { name: "connectionId", in: "path", required: true },
833
+ { name: "table", in: "path", required: true },
834
+ { name: "id", in: "path", required: true },
835
+ ],
836
+ },
737
837
  };
738
838
 
739
839
  // ── Initialize SDK client for the Office 365 Outlook connector ──
@@ -818,16 +918,152 @@ async function execOutlookOp(operationName, parameters) {
818
918
  throw new Error("No Outlook connection reference matched. Tried: " + aErrors.join(" || "));
819
919
  }
820
920
 
921
+ // ── Generic: call any Outlook connector operation ──────────────
922
+ export async function callOutlookOperation(sOperationName, oParameters) {
923
+ return _dbgWrap('callOutlookOperation', [sOperationName, oParameters], async function() {
924
+ return execOutlookOp(sOperationName, oParameters);
925
+ });
926
+ }
927
+
928
+ // ── Send Email ─────────────────────────────────────────────────
929
+ export async function sendEmail({ to, cc, bcc, subject, body, isHtml, importance, attachments } = {}) {
930
+ return _dbgWrap('sendEmail', [{ to, cc, bcc, subject, body, isHtml, importance, attachments }], async function() {
931
+ var oMessage = {
932
+ To: to,
933
+ Subject: subject,
934
+ Body: body,
935
+ };
936
+ if (cc) oMessage.Cc = cc;
937
+ if (bcc) oMessage.Bcc = bcc;
938
+ if (importance) oMessage.Importance = importance;
939
+ if (attachments) oMessage.Attachments = attachments;
940
+ if (isHtml === false) oMessage.IsHtml = false;
941
+
942
+ return execOutlookOp("SendEmailV2", { emailMessage: oMessage });
943
+ });
944
+ }
945
+
946
+ // ── Forward Email ──────────────────────────────────────────────
947
+ export async function forwardEmail(sMessageId, { to, comment } = {}) {
948
+ return _dbgWrap('forwardEmail', [sMessageId, { to, comment }], async function() {
949
+ return execOutlookOp("ForwardEmail", {
950
+ message_id: sMessageId,
951
+ body: { ToRecipients: to, Comment: comment },
952
+ });
953
+ });
954
+ }
955
+
956
+ // ── Reply to Email ─────────────────────────────────────────────
957
+ export async function replyToEmail(sMessageId, { comment, replyAll } = {}) {
958
+ return _dbgWrap('replyToEmail', [sMessageId, { comment, replyAll }], async function() {
959
+ return execOutlookOp("ReplyToV3", {
960
+ messageId: sMessageId,
961
+ replyParameters: { Body: comment, ReplyAll: replyAll === true },
962
+ });
963
+ });
964
+ }
965
+
821
966
  // ── List Emails ────────────────────────────────────────────────
822
967
  export async function listEmails({ folderId = "Inbox", fetchOnlyUnread, searchQuery, top, skip } = {}) {
823
968
  return _dbgWrap('listEmails', [{ folderId, fetchOnlyUnread, searchQuery, top, skip }], async function() {
824
- void skip;
825
-
826
969
  return execOutlookOp("GetEmailsV3", {
827
970
  folderPath: folderId,
828
- fetchOnlyUnread,
829
- searchQuery,
971
+ fetchOnlyUnread: fetchOnlyUnread,
972
+ searchQuery: searchQuery,
830
973
  top: top != null ? top : 10,
974
+ skip: skip,
975
+ });
976
+ });
977
+ }
978
+
979
+ // ── Send from Shared Mailbox ───────────────────────────────────
980
+ export async function sendFromSharedMailbox(sSharedMailbox, { to, cc, bcc, subject, body, importance, attachments } = {}) {
981
+ return _dbgWrap('sendFromSharedMailbox', [sSharedMailbox, { to, cc, bcc, subject, body, importance, attachments }], async function() {
982
+ var oMessage = {
983
+ MailboxAddress: sSharedMailbox,
984
+ To: to,
985
+ Subject: subject,
986
+ Body: body,
987
+ };
988
+ if (cc) oMessage.Cc = cc;
989
+ if (bcc) oMessage.Bcc = bcc;
990
+ if (importance) oMessage.Importance = importance;
991
+ if (attachments) oMessage.Attachments = attachments;
992
+
993
+ return execOutlookOp("SharedMailboxSendEmailV2", { emailMessage: oMessage });
994
+ });
995
+ }
996
+
997
+ // ── Move Email ─────────────────────────────────────────────────
998
+ export async function moveEmail(sMessageId, sDestinationFolderId) {
999
+ return _dbgWrap('moveEmail', [sMessageId, sDestinationFolderId], async function() {
1000
+ return execOutlookOp("MoveV2", {
1001
+ messageId: sMessageId,
1002
+ folderPath: sDestinationFolderId,
1003
+ });
1004
+ });
1005
+ }
1006
+
1007
+ // ── Delete Email ───────────────────────────────────────────────
1008
+ export async function deleteEmail(sMessageId) {
1009
+ return _dbgWrap('deleteEmail', [sMessageId], async function() {
1010
+ return execOutlookOp("DeleteEmail", { messageId: sMessageId });
1011
+ });
1012
+ }
1013
+
1014
+ // ── Create Event ───────────────────────────────────────────────
1015
+ export async function createEvent({ subject, start, end, attendees, body, location, importance, isAllDay, timeZone, calendarId } = {}) {
1016
+ return _dbgWrap('createEvent', [{ subject, start, end, attendees, body, location, importance, isAllDay, timeZone, calendarId }], async function() {
1017
+ var sAttendees = Array.isArray(attendees) ? attendees.join(";") : attendees;
1018
+ var oItem = {
1019
+ subject: subject,
1020
+ start: start,
1021
+ end: end,
1022
+ timeZone: timeZone || "",
1023
+ };
1024
+ if (sAttendees) oItem.requiredAttendees = sAttendees;
1025
+ if (body) oItem.body = body;
1026
+ if (location) oItem.location = location;
1027
+ if (importance) oItem.importance = importance;
1028
+ if (isAllDay) oItem.isAllDay = true;
1029
+
1030
+ return execOutlookOp("V4CalendarPostItem", {
1031
+ table: calendarId || "Calendar",
1032
+ item: oItem,
1033
+ });
1034
+ });
1035
+ }
1036
+
1037
+ // ── List Events ────────────────────────────────────────────────
1038
+ export async function listEvents({ calendarId = "Calendar", filter, orderBy, top, skip } = {}) {
1039
+ return _dbgWrap('listEvents', [{ calendarId, filter, orderBy, top, skip }], async function() {
1040
+ return execOutlookOp("V4CalendarGetItems", {
1041
+ table: calendarId,
1042
+ $filter: filter,
1043
+ $orderby: orderBy,
1044
+ $top: top,
1045
+ $skip: skip,
1046
+ });
1047
+ });
1048
+ }
1049
+
1050
+ // ── Edit Event ─────────────────────────────────────────────────
1051
+ export async function editEvent(sEventId, oChangedFields, sCalendarId) {
1052
+ return _dbgWrap('editEvent', [sEventId, oChangedFields, sCalendarId], async function() {
1053
+ return execOutlookOp("V4CalendarPatchItem", {
1054
+ table: sCalendarId || "Calendar",
1055
+ id: sEventId,
1056
+ item: oChangedFields,
1057
+ });
1058
+ });
1059
+ }
1060
+
1061
+ // ── Delete Event ───────────────────────────────────────────────
1062
+ export async function deleteEvent(sEventId, sCalendarId) {
1063
+ return _dbgWrap('deleteEvent', [sEventId, sCalendarId], async function() {
1064
+ return execOutlookOp("CalendarDeleteItem", {
1065
+ table: sCalendarId || "Calendar",
1066
+ id: sEventId,
831
1067
  });
832
1068
  });
833
1069
  }