codeapp-js 0.3.0 → 1.0.1
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.
- package/AI/codeapp.agent.md +105 -0
- package/AI/skills/connections/SKILL.md +47 -0
- package/AI/skills/dataverse/SKILL.md +99 -0
- package/AI/skills/environment-variables/SKILL.md +89 -0
- package/AI/skills/frontend-design/SKILL.md +34 -0
- package/AI/skills/jira/SKILL.md +81 -0
- package/AI/skills/office365-groups/SKILL.md +61 -0
- package/AI/skills/office365-outlook/SKILL.md +52 -0
- package/AI/skills/office365-users/SKILL.md +78 -0
- package/AI/skills/sharepoint/SKILL.md +77 -0
- package/AI/skills/sql/SKILL.md +85 -0
- package/AI/skills/start/SKILL.md +46 -0
- package/AI/skills/teams/SKILL.md +55 -0
- package/{examples/combined demo/.power/schemas/office365groups/office365groups.Schema.json → codeApp/.power/schemas/office365groups/office365groups.Schema.json} +2203 -2203
- package/codeApp/dist/codeapp.js +95 -1792
- package/codeApp/dist/connectors/azureKeyvault.js +459 -0
- package/codeApp/dist/connectors/jira.js +1247 -0
- package/codeApp/dist/connectors/office365groups.js +642 -0
- package/codeApp/dist/connectors/office365users.js +513 -0
- package/codeApp/dist/connectors/outlook.js +1393 -0
- package/codeApp/dist/connectors/sharepoint.js +466 -0
- package/codeApp/dist/connectors/sql.js +149 -0
- package/codeApp/dist/connectors/teams.js +280 -0
- package/codeApp/dist/power-apps-data.js +16 -2
- package/examples/{kanban → apps/kanban}/dist/dataverse.js +94 -94
- package/examples/{kanban → apps/kanban}/dist/environmentVar.js +55 -55
- package/examples/{kanban → apps/kanban}/dist/index.css +605 -605
- package/examples/{kanban → apps/kanban}/dist/index.html +21 -21
- package/examples/{kanban → apps/kanban}/dist/index.js +860 -860
- package/examples/{kanban → apps/kanban}/dist/office365groups.js +97 -97
- package/examples/apps/kanban/dist/office365users.js +451 -0
- package/examples/{kanban → apps/kanban}/dist/outlook.js +162 -162
- package/examples/{planning Poker/dist/power-apps-data.js → apps/kanban/dist/power-apps-data.js} +2953 -2953
- package/examples/{kanban → apps/kanban}/dist/sharepoint.js +435 -339
- package/examples/{kanban → apps/kanban}/power.config.json +35 -35
- package/examples/{planning Poker → apps/planning Poker}/additional files/customizations (tables).xml +6428 -6428
- package/examples/{planning Poker → apps/planning Poker}/additional files/dataverse-tables.json +165 -165
- package/examples/{planning Poker → apps/planning Poker}/additional files/readme.md +122 -122
- package/examples/{planning Poker → apps/planning Poker}/dist/dataverse.js +78 -78
- package/examples/{planning Poker → apps/planning Poker}/dist/index.html +198 -198
- package/examples/{planning Poker → apps/planning Poker}/dist/index.js +954 -954
- package/examples/{todo/dist/power-apps-data.js → apps/planning Poker/dist/power-apps-data.js } +2953 -2953
- package/examples/{planning Poker → apps/planning Poker}/dist/styles.css +815 -815
- package/examples/{planning Poker → apps/planning Poker}/power.config.json +50 -50
- package/examples/{outlook Demo2 → apps/solution explorer}/dist/codeapp.js +9 -245
- package/examples/apps/solution explorer/dist/index.html +80 -0
- package/examples/apps/solution explorer/dist/index.js +735 -0
- package/examples/apps/solution explorer/dist/styles.css +571 -0
- package/examples/apps/solution explorer/power.config.json +151 -0
- package/examples/{todo → apps/todo}/dist/dataverse.js +64 -64
- package/examples/{todo → apps/todo}/dist/index.html +75 -75
- package/examples/{todo → apps/todo}/dist/index.js +8 -8
- package/examples/{kanban → apps/todo}/dist/power-apps-data.js +2953 -2953
- package/examples/{todo → apps/todo}/dist/renderer.js +375 -375
- package/examples/{todo → apps/todo}/dist/styles.css +691 -691
- package/examples/{todo → apps/todo}/power.config.json +34 -34
- package/examples/combined demo/.power/schemas/appschemas/dataSourcesInfo.ts +6275 -7830
- package/examples/combined demo/.power/schemas/jira/jira.Schema.json +6903 -0
- package/examples/combined demo/.power/schemas/keyvault/keyvault.Schema.json +1600 -0
- package/examples/combined demo/.power/schemas/teams/teams.Schema.json +11112 -0
- package/examples/combined demo/dist/codeapp.js +394 -1098
- package/examples/{outlook Demo2/OutlookDemo_1_0_0_1.zip → combined demo/dist/icon-512.png} +0 -0
- package/examples/combined demo/dist/index.html +29 -511
- package/examples/combined demo/dist/index.js +490 -470
- package/examples/combined demo/dist/office365users.js +513 -0
- package/examples/combined demo/dist/outlook.js +1393 -0
- package/examples/combined demo/dist/power-apps-data.js +3079 -3006
- package/examples/combined demo/dist/styles.css +483 -0
- package/examples/combined demo/power.config.json +33 -42
- package/examples/combined demo/src/generated/index.ts +12 -14
- package/examples/combined demo/src/generated/models/AzureKeyVaultModel.ts +107 -0
- package/examples/combined demo/src/generated/models/JiraModel.ts +501 -0
- package/examples/combined demo/src/generated/services/AzureKeyVaultService.ts +257 -0
- package/examples/combined demo/src/generated/services/JiraService.ts +1124 -0
- package/examples/dataverse Demo/dist/codeapp.js +394 -1085
- package/examples/dataverse Demo/dist/icon-512.png +0 -0
- package/examples/dataverse Demo/dist/index.html +146 -54
- package/examples/dataverse Demo/dist/index.js +693 -83
- package/examples/dataverse Demo/dist/power-apps-data.js +3079 -2911
- package/examples/dataverse Demo/dist/styles.css +528 -0
- package/examples/dataverse Demo/power.config.json +41 -35
- package/examples/dataverse Demo/readme.md +79 -79
- package/examples/groups Demo/dist/codeapp.js +394 -1085
- package/examples/groups Demo/dist/icon-512.png +0 -0
- package/examples/groups Demo/dist/index.html +21 -25
- package/examples/groups Demo/dist/index.js +304 -113
- package/examples/groups Demo/dist/office365groups.js +642 -0
- package/examples/groups Demo/dist/power-apps-data.js +3079 -2911
- package/examples/groups Demo/dist/styles.css +509 -0
- package/examples/groups Demo/power.config.json +25 -25
- package/examples/myProfile/dist/codeapp.js +398 -0
- package/examples/myProfile/dist/index.html +21 -184
- package/examples/myProfile/dist/index.js +324 -141
- package/examples/myProfile/dist/office365users.js +517 -169
- package/examples/myProfile/dist/power-apps-data.js +3080 -2953
- package/examples/myProfile/dist/styles.css +458 -0
- package/examples/myProfile/power.config.json +24 -23
- package/examples/outlook Demo/dist/codeapp.js +394 -1085
- package/examples/outlook Demo/dist/index.html +150 -35
- package/examples/outlook Demo/dist/index.js +516 -170
- package/examples/outlook Demo/dist/outlook.js +1393 -121
- package/examples/outlook Demo/dist/power-apps-data.js +3079 -2911
- package/examples/outlook Demo/dist/styles.css +408 -84
- package/examples/outlook Demo/power.config.json +24 -23
- package/examples/outlook Demo/readme.md +92 -82
- package/examples/sharePoint Demo/dist/codeapp.js +394 -1085
- package/examples/sharePoint Demo/dist/icon-512.png +0 -0
- package/examples/sharePoint Demo/dist/index.html +22 -255
- package/examples/sharePoint Demo/dist/index.js +899 -262
- package/examples/sharePoint Demo/dist/power-apps-data.js +3079 -2911
- package/{dev files → examples/sharePoint Demo/dist}/sharepoint.js +239 -112
- package/examples/sharePoint Demo/dist/styles.css +587 -0
- package/examples/sharePoint Demo/power.config.json +23 -22
- package/package.json +1 -1
- package/readme.md +465 -76
- package/.vscode/settings.json +0 -6
- package/dev files/customConnector.js +0 -98
- package/dev files/dataverse.js +0 -120
- package/dev files/environmentVar.js +0 -55
- package/dev files/office365groups.js +0 -65
- package/dev files/office365users.js +0 -169
- package/dev files/outlook.js +0 -330
- package/dev files/power-apps-data.js +0 -2952
- package/examples/combined demo/.power/schemas/office365/office365.Schema.json +0 -21098
- package/examples/combined demo/.power/schemas/office365users/office365users.Schema.json +0 -2094
- package/examples/kanban/agent/decision-log.md +0 -9
- package/examples/kanban/agent/mockup-01-editorial-glass.html +0 -159
- package/examples/kanban/agent/mockup-02-dark-rail.html +0 -147
- package/examples/kanban/agent/mockup-03-paper-grid.html +0 -114
- package/examples/kanban/agent/mockup-04-neon-minimal.html +0 -141
- package/examples/kanban/agent/mockup-05-mono-architect.html +0 -119
- package/examples/kanban/dist/office365users.js +0 -169
- package/examples/kanban/src/generated/index.ts +0 -14
- package/examples/kanban/src/generated/models/Office365GroupsModel.ts +0 -363
- package/examples/kanban/src/generated/models/Office365OutlookModel.ts +0 -2046
- package/examples/kanban/src/generated/models/Office365UsersModel.ts +0 -254
- package/examples/kanban/src/generated/services/Office365GroupsService.ts +0 -326
- package/examples/kanban/src/generated/services/Office365OutlookService.ts +0 -2476
- package/examples/kanban/src/generated/services/Office365UsersService.ts +0 -358
- package/examples/outlook Demo2/agent/decision-log.md +0 -7
- package/examples/outlook Demo2/dist/index.html +0 -98
- package/examples/outlook Demo2/dist/index.js +0 -272
- package/examples/outlook Demo2/dist/styles.css +0 -639
- package/examples/outlook Demo2/power.config.json +0 -23
- package/examples/planning Poker/.vscode/settings.json +0 -5
- package/examples/sharePoint Demo/agent/decision-log.md +0 -17
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/index.ts +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/models/Office365GroupsModel.ts +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/models/Office365OutlookModel.ts +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/models/Office365UsersModel.ts +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/services/Office365GroupsService.ts +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/services/Office365OutlookService.ts +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/services/Office365UsersService.ts +0 -0
- /package/examples/{planning Poker → apps/planning Poker}/additional files/AgilePoker_1_0_0_1.zip +0 -0
- /package/examples/{planning Poker → apps/planning Poker}/additional files/PokerTables_1_0_0_1.zip +0 -0
- /package/examples/{outlook Demo2 → apps/solution explorer}/dist/icon-512.png +0 -0
- /package/examples/{outlook Demo2 → apps/solution explorer}/dist/power-apps-data.js +0 -0
- /package/examples/{todo → apps/todo}/dist/icon192.png +0 -0
|
@@ -0,0 +1,1393 @@
|
|
|
1
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
2
|
+
// ────────────────────────────── Outlook365 ──────────────────────────────────
|
|
3
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
4
|
+
import {_dbgWrap } from "../codeapp.js";
|
|
5
|
+
import { getClient} from "../power-apps-data.js";
|
|
6
|
+
// ── Data source name (must match connectionReferences in power.config.json) ──
|
|
7
|
+
const DATA_SOURCE_CANDIDATES = ["office365outlook", "Office365Outlook", "office365"];
|
|
8
|
+
const OUTLOOK_APIS = {
|
|
9
|
+
// ── Email operations ──
|
|
10
|
+
GetEmailsV3: {
|
|
11
|
+
path: "/{connectionId}/v3/Mail",
|
|
12
|
+
method: "GET",
|
|
13
|
+
parameters: [
|
|
14
|
+
{ name: "connectionId", in: "path", required: true },
|
|
15
|
+
{ name: "folderPath", in: "query", required: false },
|
|
16
|
+
{ name: "to", in: "query", required: false },
|
|
17
|
+
{ name: "cc", in: "query", required: false },
|
|
18
|
+
{ name: "toOrCc", in: "query", required: false },
|
|
19
|
+
{ name: "from", in: "query", required: false },
|
|
20
|
+
{ name: "importance", in: "query", required: false },
|
|
21
|
+
{ name: "fetchOnlyWithAttachment", in: "query", required: false },
|
|
22
|
+
{ name: "subjectFilter", in: "query", required: false },
|
|
23
|
+
{ name: "fetchOnlyUnread", in: "query", required: false },
|
|
24
|
+
{ name: "fetchOnlyFlagged", in: "query", required: false },
|
|
25
|
+
{ name: "mailboxAddress", in: "query", required: false },
|
|
26
|
+
{ name: "includeAttachments", in: "query", required: false },
|
|
27
|
+
{ name: "searchQuery", in: "query", required: false },
|
|
28
|
+
{ name: "top", in: "query", required: false },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
SendEmailV2: {
|
|
32
|
+
path: "/{connectionId}/v2/Mail",
|
|
33
|
+
method: "POST",
|
|
34
|
+
parameters: [
|
|
35
|
+
{ name: "connectionId", in: "path", required: true },
|
|
36
|
+
{ name: "emailMessage", in: "body", required: true },
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
ForwardEmail: {
|
|
40
|
+
path: "/{connectionId}/codeless/api/v2.0/me/messages/{message_id}/forward",
|
|
41
|
+
method: "POST",
|
|
42
|
+
parameters: [
|
|
43
|
+
{ name: "connectionId", in: "path", required: true },
|
|
44
|
+
{ name: "message_id", in: "path", required: true },
|
|
45
|
+
{ name: "body", in: "body", required: true },
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
ReplyToV3: {
|
|
49
|
+
path: "/{connectionId}/v3/Mail/ReplyTo/{messageId}",
|
|
50
|
+
method: "POST",
|
|
51
|
+
parameters: [
|
|
52
|
+
{ name: "connectionId", in: "path", required: true },
|
|
53
|
+
{ name: "messageId", in: "path", required: true },
|
|
54
|
+
{ name: "replyParameters", in: "body", required: true },
|
|
55
|
+
{ name: "mailboxAddress", in: "query", required: false },
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
MoveV2: {
|
|
59
|
+
path: "/{connectionId}/v2/Mail/Move/{messageId}",
|
|
60
|
+
method: "POST",
|
|
61
|
+
parameters: [
|
|
62
|
+
{ name: "connectionId", in: "path", required: true },
|
|
63
|
+
{ name: "messageId", in: "path", required: true },
|
|
64
|
+
{ name: "folderPath", in: "query", required: true },
|
|
65
|
+
{ name: "mailboxAddress", in: "query", required: false },
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
DeleteEmail: {
|
|
69
|
+
path: "/{connectionId}/Mail/{messageId}",
|
|
70
|
+
method: "DELETE",
|
|
71
|
+
parameters: [
|
|
72
|
+
{ name: "connectionId", in: "path", required: true },
|
|
73
|
+
{ name: "messageId", in: "path", required: true },
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
SharedMailboxSendEmailV2: {
|
|
77
|
+
path: "/{connectionId}/v2/SharedMailbox/Mail",
|
|
78
|
+
method: "POST",
|
|
79
|
+
parameters: [
|
|
80
|
+
{ name: "connectionId", in: "path", required: true },
|
|
81
|
+
{ name: "emailMessage", in: "body", required: true },
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
// ── Calendar operations ──
|
|
85
|
+
V4CalendarGetItems: {
|
|
86
|
+
path: "/{connectionId}/datasets/calendars/v4/tables/{table}/items",
|
|
87
|
+
method: "GET",
|
|
88
|
+
parameters: [
|
|
89
|
+
{ name: "connectionId", in: "path", required: true },
|
|
90
|
+
{ name: "table", in: "path", required: true },
|
|
91
|
+
{ name: "$filter", in: "query", required: false },
|
|
92
|
+
{ name: "$orderby", in: "query", required: false },
|
|
93
|
+
{ name: "$top", in: "query", required: false },
|
|
94
|
+
{ name: "$skip", in: "query", required: false },
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
V4CalendarPostItem: {
|
|
98
|
+
path: "/{connectionId}/datasets/calendars/v4/tables/{table}/items",
|
|
99
|
+
method: "POST",
|
|
100
|
+
parameters: [
|
|
101
|
+
{ name: "connectionId", in: "path", required: true },
|
|
102
|
+
{ name: "table", in: "path", required: true },
|
|
103
|
+
{ name: "item", in: "body", required: true },
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
V4CalendarPatchItem: {
|
|
107
|
+
path: "/{connectionId}/datasets/calendars/v4/tables/{table}/items/{id}",
|
|
108
|
+
method: "PATCH",
|
|
109
|
+
parameters: [
|
|
110
|
+
{ name: "connectionId", in: "path", required: true },
|
|
111
|
+
{ name: "table", in: "path", required: true },
|
|
112
|
+
{ name: "id", in: "path", required: true },
|
|
113
|
+
{ name: "item", in: "body", required: true },
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
CalendarDeleteItem: {
|
|
117
|
+
path: "/{connectionId}/datasets/calendars/tables/{table}/items/{id}",
|
|
118
|
+
method: "DELETE",
|
|
119
|
+
parameters: [
|
|
120
|
+
{ name: "connectionId", in: "path", required: true },
|
|
121
|
+
{ name: "table", in: "path", required: true },
|
|
122
|
+
{ name: "id", in: "path", required: true },
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
Object.assign(OUTLOOK_APIS, JSON.parse(String.raw`{
|
|
128
|
+
"GetEmailsV2": {
|
|
129
|
+
"path": "/{connectionId}/v2/Mail",
|
|
130
|
+
"method": "GET",
|
|
131
|
+
"parameters": [
|
|
132
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
133
|
+
{ "name": "folderPath", "in": "query", "required": false, "type": "string" },
|
|
134
|
+
{ "name": "to", "in": "query", "required": false, "type": "string" },
|
|
135
|
+
{ "name": "cc", "in": "query", "required": false, "type": "string" },
|
|
136
|
+
{ "name": "toOrCc", "in": "query", "required": false, "type": "string" },
|
|
137
|
+
{ "name": "from", "in": "query", "required": false, "type": "string" },
|
|
138
|
+
{ "name": "importance", "in": "query", "required": false, "type": "string" },
|
|
139
|
+
{ "name": "fetchOnlyWithAttachment", "in": "query", "required": false, "type": "boolean" },
|
|
140
|
+
{ "name": "subjectFilter", "in": "query", "required": false, "type": "string" },
|
|
141
|
+
{ "name": "fetchOnlyUnread", "in": "query", "required": false, "type": "boolean" },
|
|
142
|
+
{ "name": "fetchOnlyFlagged", "in": "query", "required": false, "type": "boolean" },
|
|
143
|
+
{ "name": "mailboxAddress", "in": "query", "required": false, "type": "string" },
|
|
144
|
+
{ "name": "includeAttachments", "in": "query", "required": false, "type": "boolean" },
|
|
145
|
+
{ "name": "searchQuery", "in": "query", "required": false, "type": "string" },
|
|
146
|
+
{ "name": "top", "in": "query", "required": false, "type": "integer" }
|
|
147
|
+
]
|
|
148
|
+
},
|
|
149
|
+
"GetEmail": {
|
|
150
|
+
"path": "/{connectionId}/Mail/{messageId}",
|
|
151
|
+
"method": "GET",
|
|
152
|
+
"parameters": [
|
|
153
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
154
|
+
{ "name": "messageId", "in": "path", "required": true, "type": "string" },
|
|
155
|
+
{ "name": "mailboxAddress", "in": "query", "required": false, "type": "string" },
|
|
156
|
+
{ "name": "includeAttachments", "in": "query", "required": false, "type": "boolean" },
|
|
157
|
+
{ "name": "internetMessageId", "in": "query", "required": false, "type": "string" }
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
"GetEmailV2": {
|
|
161
|
+
"path": "/{connectionId}/v2/Mail/{messageId}",
|
|
162
|
+
"method": "GET",
|
|
163
|
+
"parameters": [
|
|
164
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
165
|
+
{ "name": "messageId", "in": "path", "required": true, "type": "string" },
|
|
166
|
+
{ "name": "mailboxAddress", "in": "query", "required": false, "type": "string" },
|
|
167
|
+
{ "name": "includeAttachments", "in": "query", "required": false, "type": "boolean" },
|
|
168
|
+
{ "name": "internetMessageId", "in": "query", "required": false, "type": "string" },
|
|
169
|
+
{ "name": "extractSensitivityLabel", "in": "query", "required": false, "type": "boolean" },
|
|
170
|
+
{ "name": "fetchSensitivityLabelMetadata", "in": "query", "required": false, "type": "boolean" }
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
"SendEmail": {
|
|
174
|
+
"path": "/{connectionId}/Mail",
|
|
175
|
+
"method": "POST",
|
|
176
|
+
"parameters": [
|
|
177
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
178
|
+
{ "name": "emailMessage", "in": "body", "required": true, "type": "object" }
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
"DraftEmail": {
|
|
182
|
+
"path": "/{connectionId}/Draft",
|
|
183
|
+
"method": "POST",
|
|
184
|
+
"parameters": [
|
|
185
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
186
|
+
{ "name": "draftMessage", "in": "body", "required": true, "type": "object" },
|
|
187
|
+
{ "name": "messageId", "in": "query", "required": false, "type": "string" },
|
|
188
|
+
{ "name": "draftType", "in": "query", "required": false, "type": "string" },
|
|
189
|
+
{ "name": "comment", "in": "query", "required": false, "type": "string" }
|
|
190
|
+
]
|
|
191
|
+
},
|
|
192
|
+
"UpdateDraftEmail": {
|
|
193
|
+
"path": "/{connectionId}/Draft",
|
|
194
|
+
"method": "PATCH",
|
|
195
|
+
"parameters": [
|
|
196
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
197
|
+
{ "name": "draftMessage", "in": "body", "required": true, "type": "object" },
|
|
198
|
+
{ "name": "messageId", "in": "query", "required": true, "type": "string" }
|
|
199
|
+
]
|
|
200
|
+
},
|
|
201
|
+
"SendDraftEmail": {
|
|
202
|
+
"path": "/{connectionId}/Draft/Send/{messageId}",
|
|
203
|
+
"method": "POST",
|
|
204
|
+
"parameters": [
|
|
205
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
206
|
+
{ "name": "messageId", "in": "path", "required": true, "type": "string" }
|
|
207
|
+
]
|
|
208
|
+
},
|
|
209
|
+
"DeleteEmail_V2": {
|
|
210
|
+
"path": "/{connectionId}/codeless/v1.0/me/messages/{messageId}",
|
|
211
|
+
"method": "DELETE",
|
|
212
|
+
"parameters": [
|
|
213
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
214
|
+
{ "name": "messageId", "in": "path", "required": true, "type": "string" },
|
|
215
|
+
{ "name": "mailboxAddress", "in": "query", "required": false, "type": "string" }
|
|
216
|
+
]
|
|
217
|
+
},
|
|
218
|
+
"ForwardEmail_V2": {
|
|
219
|
+
"path": "/{connectionId}/codeless/v1.0/me/messages/{message_id}/forward",
|
|
220
|
+
"method": "POST",
|
|
221
|
+
"parameters": [
|
|
222
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
223
|
+
{ "name": "message_id", "in": "path", "required": true, "type": "string" },
|
|
224
|
+
{ "name": "body", "in": "body", "required": true, "type": "object" },
|
|
225
|
+
{ "name": "mailboxAddress", "in": "query", "required": false, "type": "string" }
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
"ReplyToV2": {
|
|
229
|
+
"path": "/{connectionId}/v2/Mail/ReplyTo/{messageId}",
|
|
230
|
+
"method": "POST",
|
|
231
|
+
"parameters": [
|
|
232
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
233
|
+
{ "name": "messageId", "in": "path", "required": true, "type": "string" },
|
|
234
|
+
{ "name": "replyParameters", "in": "body", "required": true, "type": "object" },
|
|
235
|
+
{ "name": "mailboxAddress", "in": "query", "required": false, "type": "string" }
|
|
236
|
+
]
|
|
237
|
+
},
|
|
238
|
+
"Flag": {
|
|
239
|
+
"path": "/{connectionId}/Mail/Flag/{messageId}",
|
|
240
|
+
"method": "POST",
|
|
241
|
+
"parameters": [
|
|
242
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
243
|
+
{ "name": "messageId", "in": "path", "required": true, "type": "string" }
|
|
244
|
+
]
|
|
245
|
+
},
|
|
246
|
+
"Flag_V2": {
|
|
247
|
+
"path": "/{connectionId}/codeless/v1.0/me/messages/{messageId}/flag",
|
|
248
|
+
"method": "PATCH",
|
|
249
|
+
"parameters": [
|
|
250
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
251
|
+
{ "name": "messageId", "in": "path", "required": true, "type": "string" },
|
|
252
|
+
{ "name": "mailboxAddress", "in": "query", "required": false, "type": "string" },
|
|
253
|
+
{ "name": "body", "in": "body", "required": false, "type": "object" }
|
|
254
|
+
]
|
|
255
|
+
},
|
|
256
|
+
"MarkAsRead": {
|
|
257
|
+
"path": "/{connectionId}/Mail/MarkAsRead/{messageId}",
|
|
258
|
+
"method": "POST",
|
|
259
|
+
"parameters": [
|
|
260
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
261
|
+
{ "name": "messageId", "in": "path", "required": true, "type": "string" }
|
|
262
|
+
]
|
|
263
|
+
},
|
|
264
|
+
"MarkAsRead_V2": {
|
|
265
|
+
"path": "/{connectionId}/codeless/v1.0/me/messages/{messageId}/markAsRead",
|
|
266
|
+
"method": "PATCH",
|
|
267
|
+
"parameters": [
|
|
268
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
269
|
+
{ "name": "messageId", "in": "path", "required": true, "type": "string" },
|
|
270
|
+
{ "name": "mailboxAddress", "in": "query", "required": false, "type": "string" },
|
|
271
|
+
{ "name": "body", "in": "body", "required": false, "type": "object" }
|
|
272
|
+
]
|
|
273
|
+
},
|
|
274
|
+
"MarkAsRead_V3": {
|
|
275
|
+
"path": "/{connectionId}/codeless/v3/v1.0/me/messages/{messageId}/markAsRead",
|
|
276
|
+
"method": "PATCH",
|
|
277
|
+
"parameters": [
|
|
278
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
279
|
+
{ "name": "messageId", "in": "path", "required": true, "type": "string" },
|
|
280
|
+
{ "name": "mailboxAddress", "in": "query", "required": false, "type": "string" },
|
|
281
|
+
{ "name": "body", "in": "body", "required": false, "type": "object" }
|
|
282
|
+
]
|
|
283
|
+
},
|
|
284
|
+
"GetAttachment": {
|
|
285
|
+
"path": "/{connectionId}/Mail/{messageId}/Attachments/{attachmentId}",
|
|
286
|
+
"method": "GET",
|
|
287
|
+
"parameters": [
|
|
288
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
289
|
+
{ "name": "messageId", "in": "path", "required": true, "type": "string" },
|
|
290
|
+
{ "name": "attachmentId", "in": "path", "required": true, "type": "string" }
|
|
291
|
+
]
|
|
292
|
+
},
|
|
293
|
+
"GetAttachment_V2": {
|
|
294
|
+
"path": "/{connectionId}/codeless/v1.0/me/messages/{messageId}/attachments/{attachmentId}",
|
|
295
|
+
"method": "GET",
|
|
296
|
+
"parameters": [
|
|
297
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
298
|
+
{ "name": "messageId", "in": "path", "required": true, "type": "string" },
|
|
299
|
+
{ "name": "attachmentId", "in": "path", "required": true, "type": "string" },
|
|
300
|
+
{ "name": "mailboxAddress", "in": "query", "required": false, "type": "string" },
|
|
301
|
+
{ "name": "extractSensitivityLabel", "in": "query", "required": false, "type": "boolean" },
|
|
302
|
+
{ "name": "fetchSensitivityLabelMetadata", "in": "query", "required": false, "type": "boolean" }
|
|
303
|
+
]
|
|
304
|
+
},
|
|
305
|
+
"AssignCategory": {
|
|
306
|
+
"path": "/{connectionId}/Mail/Category",
|
|
307
|
+
"method": "POST",
|
|
308
|
+
"parameters": [
|
|
309
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
310
|
+
{ "name": "messageId", "in": "query", "required": true, "type": "string" },
|
|
311
|
+
{ "name": "category", "in": "query", "required": true, "type": "string" }
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
"AssignCategoryBulk": {
|
|
315
|
+
"path": "/{connectionId}/Mail/Category/Bulk/{categoryName}",
|
|
316
|
+
"method": "POST",
|
|
317
|
+
"parameters": [
|
|
318
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
319
|
+
{ "name": "messageIds", "in": "body", "required": true, "type": "object" },
|
|
320
|
+
{ "name": "categoryName", "in": "path", "required": true, "type": "string" }
|
|
321
|
+
]
|
|
322
|
+
},
|
|
323
|
+
"GetOutlookCategoryNames": {
|
|
324
|
+
"path": "/{connectionId}/Categories",
|
|
325
|
+
"method": "GET",
|
|
326
|
+
"parameters": [
|
|
327
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" }
|
|
328
|
+
]
|
|
329
|
+
},
|
|
330
|
+
"SharedMailboxSendEmail": {
|
|
331
|
+
"path": "/{connectionId}/SharedMailbox/Mail",
|
|
332
|
+
"method": "POST",
|
|
333
|
+
"parameters": [
|
|
334
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
335
|
+
{ "name": "emailMessage", "in": "body", "required": true, "type": "object" }
|
|
336
|
+
]
|
|
337
|
+
},
|
|
338
|
+
"V3CalendarGetItem": {
|
|
339
|
+
"path": "/{connectionId}/datasets/calendars/v3/tables/{table}/items/{id}",
|
|
340
|
+
"method": "GET",
|
|
341
|
+
"parameters": [
|
|
342
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
343
|
+
{ "name": "table", "in": "path", "required": true, "type": "string" },
|
|
344
|
+
{ "name": "id", "in": "path", "required": true, "type": "string" }
|
|
345
|
+
]
|
|
346
|
+
},
|
|
347
|
+
"GetEventsCalendarViewV3": {
|
|
348
|
+
"path": "/{connectionId}/datasets/calendars/v3/tables/items/calendarview",
|
|
349
|
+
"method": "GET",
|
|
350
|
+
"parameters": [
|
|
351
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
352
|
+
{ "name": "calendarId", "in": "query", "required": true, "type": "string" },
|
|
353
|
+
{ "name": "startDateTimeUtc", "in": "query", "required": true, "type": "string" },
|
|
354
|
+
{ "name": "endDateTimeUtc", "in": "query", "required": true, "type": "string" },
|
|
355
|
+
{ "name": "$filter", "in": "query", "required": false, "type": "string" },
|
|
356
|
+
{ "name": "$orderby", "in": "query", "required": false, "type": "string" },
|
|
357
|
+
{ "name": "$top", "in": "query", "required": false, "type": "integer" },
|
|
358
|
+
{ "name": "$skip", "in": "query", "required": false, "type": "integer" },
|
|
359
|
+
{ "name": "search", "in": "query", "required": false, "type": "string" }
|
|
360
|
+
]
|
|
361
|
+
},
|
|
362
|
+
"RespondToEvent_V2": {
|
|
363
|
+
"path": "/{connectionId}/codeless/v1.0/me/events/{event_id}/{response}",
|
|
364
|
+
"method": "POST",
|
|
365
|
+
"parameters": [
|
|
366
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
367
|
+
{ "name": "event_id", "in": "path", "required": true, "type": "string" },
|
|
368
|
+
{ "name": "response", "in": "path", "required": true, "type": "string" },
|
|
369
|
+
{ "name": "body", "in": "body", "required": false, "type": "object" }
|
|
370
|
+
]
|
|
371
|
+
},
|
|
372
|
+
"CalendarGetTables_V2": {
|
|
373
|
+
"path": "/{connectionId}/codeless/v1.0/me/calendars",
|
|
374
|
+
"method": "GET",
|
|
375
|
+
"parameters": [
|
|
376
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
377
|
+
{ "name": "skip", "in": "query", "required": false, "type": "integer" },
|
|
378
|
+
{ "name": "top", "in": "query", "required": false, "type": "integer" },
|
|
379
|
+
{ "name": "orderBy", "in": "query", "required": false, "type": "string" }
|
|
380
|
+
]
|
|
381
|
+
},
|
|
382
|
+
"ContactGetTablesV2": {
|
|
383
|
+
"path": "/{connectionId}/v2/datasets/contacts/tables",
|
|
384
|
+
"method": "GET",
|
|
385
|
+
"parameters": [
|
|
386
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" }
|
|
387
|
+
]
|
|
388
|
+
},
|
|
389
|
+
"ContactGetItems_V2": {
|
|
390
|
+
"path": "/{connectionId}/codeless/v1.0/me/contactFolders/{folder}/contacts",
|
|
391
|
+
"method": "GET",
|
|
392
|
+
"parameters": [
|
|
393
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
394
|
+
{ "name": "folder", "in": "path", "required": true, "type": "string" },
|
|
395
|
+
{ "name": "$filter", "in": "query", "required": false, "type": "string" },
|
|
396
|
+
{ "name": "$orderby", "in": "query", "required": false, "type": "string" },
|
|
397
|
+
{ "name": "$top", "in": "query", "required": false, "type": "integer" },
|
|
398
|
+
{ "name": "$skip", "in": "query", "required": false, "type": "integer" }
|
|
399
|
+
]
|
|
400
|
+
},
|
|
401
|
+
"ContactGetItem_V2": {
|
|
402
|
+
"path": "/{connectionId}/codeless/v1.0/me/contactFolders/{folder}/contacts/{id}",
|
|
403
|
+
"method": "GET",
|
|
404
|
+
"parameters": [
|
|
405
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
406
|
+
{ "name": "folder", "in": "path", "required": true, "type": "string" },
|
|
407
|
+
{ "name": "id", "in": "path", "required": true, "type": "string" }
|
|
408
|
+
]
|
|
409
|
+
},
|
|
410
|
+
"ContactPostItem_V2": {
|
|
411
|
+
"path": "/{connectionId}/codeless/v1.0/me/contactFolders/{folder}/contacts",
|
|
412
|
+
"method": "POST",
|
|
413
|
+
"parameters": [
|
|
414
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
415
|
+
{ "name": "folder", "in": "path", "required": true, "type": "string" },
|
|
416
|
+
{ "name": "item", "in": "body", "required": true, "type": "object" }
|
|
417
|
+
]
|
|
418
|
+
},
|
|
419
|
+
"ContactPatchItem_V2": {
|
|
420
|
+
"path": "/{connectionId}/codeless/v1.0/me/contactFolders/{folder}/contacts/{id}",
|
|
421
|
+
"method": "PATCH",
|
|
422
|
+
"parameters": [
|
|
423
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
424
|
+
{ "name": "folder", "in": "path", "required": true, "type": "string" },
|
|
425
|
+
{ "name": "id", "in": "path", "required": true, "type": "string" },
|
|
426
|
+
{ "name": "item", "in": "body", "required": true, "type": "object" }
|
|
427
|
+
]
|
|
428
|
+
},
|
|
429
|
+
"ContactDeleteItem_V2": {
|
|
430
|
+
"path": "/{connectionId}/codeless/v1.0/me/contactFolders/{folder}/contacts/{id}",
|
|
431
|
+
"method": "DELETE",
|
|
432
|
+
"parameters": [
|
|
433
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
434
|
+
{ "name": "folder", "in": "path", "required": true, "type": "string" },
|
|
435
|
+
{ "name": "id", "in": "path", "required": true, "type": "string" }
|
|
436
|
+
]
|
|
437
|
+
},
|
|
438
|
+
"GetRoomLists_V2": {
|
|
439
|
+
"path": "/{connectionId}/codeless/beta/me/findRoomLists",
|
|
440
|
+
"method": "GET",
|
|
441
|
+
"parameters": [
|
|
442
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" }
|
|
443
|
+
]
|
|
444
|
+
},
|
|
445
|
+
"GetRooms_V2": {
|
|
446
|
+
"path": "/{connectionId}/codeless/beta/me/findRooms",
|
|
447
|
+
"method": "GET",
|
|
448
|
+
"parameters": [
|
|
449
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" }
|
|
450
|
+
]
|
|
451
|
+
},
|
|
452
|
+
"GetRoomsInRoomList_V2": {
|
|
453
|
+
"path": "/{connectionId}/codeless/beta/me/findRooms(RoomList='{room_list}')",
|
|
454
|
+
"method": "GET",
|
|
455
|
+
"parameters": [
|
|
456
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
457
|
+
{ "name": "room_list", "in": "path", "required": true, "type": "string" }
|
|
458
|
+
]
|
|
459
|
+
},
|
|
460
|
+
"FindMeetingTimes_V2": {
|
|
461
|
+
"path": "/{connectionId}/codeless/beta/me/findMeetingTimes",
|
|
462
|
+
"method": "POST",
|
|
463
|
+
"parameters": [
|
|
464
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
465
|
+
{ "name": "body", "in": "body", "required": true, "type": "object" }
|
|
466
|
+
]
|
|
467
|
+
},
|
|
468
|
+
"SetAutomaticRepliesSetting": {
|
|
469
|
+
"path": "/{connectionId}/AutomaticRepliesSetting",
|
|
470
|
+
"method": "POST",
|
|
471
|
+
"parameters": [
|
|
472
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
473
|
+
{ "name": "clientSetting", "in": "body", "required": true, "type": "object" }
|
|
474
|
+
]
|
|
475
|
+
},
|
|
476
|
+
"SetAutomaticRepliesSetting_V2": {
|
|
477
|
+
"path": "/{connectionId}/codeless/v1.0/me/mailboxSettings",
|
|
478
|
+
"method": "PATCH",
|
|
479
|
+
"parameters": [
|
|
480
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
481
|
+
{ "name": "body", "in": "body", "required": true, "type": "object" }
|
|
482
|
+
]
|
|
483
|
+
},
|
|
484
|
+
"GetMailTips": {
|
|
485
|
+
"path": "/{connectionId}/MailTips",
|
|
486
|
+
"method": "GET",
|
|
487
|
+
"parameters": [
|
|
488
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
489
|
+
{ "name": "mailboxAddress", "in": "query", "required": true, "type": "string" }
|
|
490
|
+
]
|
|
491
|
+
},
|
|
492
|
+
"GetMailTips_V2": {
|
|
493
|
+
"path": "/{connectionId}/codeless/v1.0/me/getMailTips",
|
|
494
|
+
"method": "POST",
|
|
495
|
+
"parameters": [
|
|
496
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
497
|
+
{ "name": "body", "in": "body", "required": true, "type": "object" }
|
|
498
|
+
]
|
|
499
|
+
},
|
|
500
|
+
"HttpRequest": {
|
|
501
|
+
"path": "/{connectionId}/codeless/httprequest",
|
|
502
|
+
"method": "POST",
|
|
503
|
+
"parameters": [
|
|
504
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
505
|
+
{ "name": "Uri", "in": "header", "required": true, "type": "string" },
|
|
506
|
+
{ "name": "Method", "in": "header", "required": true, "type": "string" },
|
|
507
|
+
{ "name": "Body", "in": "body", "required": false, "type": "object" },
|
|
508
|
+
{ "name": "ContentType", "in": "header", "required": false, "type": "string" },
|
|
509
|
+
{ "name": "CustomHeader1", "in": "header", "required": false, "type": "string" },
|
|
510
|
+
{ "name": "CustomHeader2", "in": "header", "required": false, "type": "string" },
|
|
511
|
+
{ "name": "CustomHeader3", "in": "header", "required": false, "type": "string" },
|
|
512
|
+
{ "name": "CustomHeader4", "in": "header", "required": false, "type": "string" },
|
|
513
|
+
{ "name": "CustomHeader5", "in": "header", "required": false, "type": "string" }
|
|
514
|
+
]
|
|
515
|
+
},
|
|
516
|
+
"mcp_EmailsManagement": {
|
|
517
|
+
"path": "/{connectionId}/mcp/EmailsManagement",
|
|
518
|
+
"method": "POST",
|
|
519
|
+
"parameters": [
|
|
520
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
521
|
+
{ "name": "queryRequest", "in": "body", "required": false, "type": "object" },
|
|
522
|
+
{ "name": "sessionId", "in": "query", "required": false, "type": "string" }
|
|
523
|
+
]
|
|
524
|
+
},
|
|
525
|
+
"mcp_MeetingManagement": {
|
|
526
|
+
"path": "/{connectionId}/mcp/MeetingManagement",
|
|
527
|
+
"method": "POST",
|
|
528
|
+
"parameters": [
|
|
529
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
530
|
+
{ "name": "queryRequest", "in": "body", "required": false, "type": "object" },
|
|
531
|
+
{ "name": "sessionId", "in": "query", "required": false, "type": "string" }
|
|
532
|
+
]
|
|
533
|
+
},
|
|
534
|
+
"mcp_ContactsManagement": {
|
|
535
|
+
"path": "/{connectionId}/mcp/ContactsManagement",
|
|
536
|
+
"method": "POST",
|
|
537
|
+
"parameters": [
|
|
538
|
+
{ "name": "connectionId", "in": "path", "required": true, "type": "string" },
|
|
539
|
+
{ "name": "queryRequest", "in": "body", "required": false, "type": "object" },
|
|
540
|
+
{ "name": "sessionId", "in": "query", "required": false, "type": "string" }
|
|
541
|
+
]
|
|
542
|
+
}
|
|
543
|
+
}`));
|
|
544
|
+
|
|
545
|
+
// ── Initialize SDK client for the Office 365 Outlook connector ──
|
|
546
|
+
function initOutlookClient() {
|
|
547
|
+
const dataSourcesInfo = {};
|
|
548
|
+
|
|
549
|
+
DATA_SOURCE_CANDIDATES.forEach((sDataSourceName) => {
|
|
550
|
+
dataSourcesInfo[sDataSourceName] = {
|
|
551
|
+
tableId: "",
|
|
552
|
+
version: "",
|
|
553
|
+
primaryKey: "",
|
|
554
|
+
dataSourceType: "Connector",
|
|
555
|
+
apis: OUTLOOK_APIS,
|
|
556
|
+
};
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
return getClient(dataSourcesInfo);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function stringifyOutlookError(oError) {
|
|
563
|
+
if (!oError) return "Operation failed";
|
|
564
|
+
if (typeof oError === "string") return oError;
|
|
565
|
+
if (oError instanceof Error) return oError.message || "Operation failed";
|
|
566
|
+
|
|
567
|
+
var aPropertyNames = Object.getOwnPropertyNames(oError);
|
|
568
|
+
var oSerializable = {};
|
|
569
|
+
aPropertyNames.forEach((sName) => {
|
|
570
|
+
oSerializable[sName] = oError[sName];
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
try {
|
|
574
|
+
return JSON.stringify(oSerializable);
|
|
575
|
+
} catch {
|
|
576
|
+
return String(oError);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
function unwrapOutlookResult(oResult) {
|
|
581
|
+
if (oResult && oResult.success === false) {
|
|
582
|
+
var sMessage = stringifyOutlookError(oResult.error);
|
|
583
|
+
if (oResult.data !== undefined) {
|
|
584
|
+
sMessage += " | data: " + stringifyOutlookError(oResult.data);
|
|
585
|
+
}
|
|
586
|
+
throw new Error(sMessage);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
if (oResult && Object.prototype.hasOwnProperty.call(oResult, "data")) {
|
|
590
|
+
return oResult.data;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
return oResult;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
function isOutlookObject(oValue) {
|
|
597
|
+
return !!oValue && typeof oValue === "object" && !Array.isArray(oValue);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
function pickOutlookValue() {
|
|
601
|
+
for (let iIndex = 0; iIndex < arguments.length; iIndex += 1) {
|
|
602
|
+
if (arguments[iIndex] !== undefined && arguments[iIndex] !== null) {
|
|
603
|
+
return arguments[iIndex];
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
return undefined;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
function setOutlookIfDefined(oTarget, sKey, oValue) {
|
|
611
|
+
if (oValue !== undefined && oValue !== null) {
|
|
612
|
+
oTarget[sKey] = oValue;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
return oTarget;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
function normalizeOutlookList(value) {
|
|
619
|
+
if (Array.isArray(value)) {
|
|
620
|
+
return value.map(function(item) {
|
|
621
|
+
if (typeof item === "string") {
|
|
622
|
+
return item;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
if (isOutlookObject(item)) {
|
|
626
|
+
return pickOutlookValue(
|
|
627
|
+
item.Address,
|
|
628
|
+
item.address,
|
|
629
|
+
item.EmailAddress && item.EmailAddress.Address,
|
|
630
|
+
item.EmailAddress && item.EmailAddress.address
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
return item;
|
|
635
|
+
}).filter(Boolean).join(";");
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
return value;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
function normalizeOutlookAttachments(aAttachments) {
|
|
642
|
+
if (!Array.isArray(aAttachments)) {
|
|
643
|
+
return aAttachments;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
return aAttachments.map(function(oAttachment) {
|
|
647
|
+
if (!isOutlookObject(oAttachment)) {
|
|
648
|
+
return oAttachment;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
const oNormalized = Object.assign({}, oAttachment);
|
|
652
|
+
setOutlookIfDefined(oNormalized, "Name", pickOutlookValue(oAttachment.Name, oAttachment.name));
|
|
653
|
+
setOutlookIfDefined(oNormalized, "ContentBytes", pickOutlookValue(oAttachment.ContentBytes, oAttachment.contentBytes));
|
|
654
|
+
return oNormalized;
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
function normalizeEmailMessage(oOptions, bSupportsPlainText) {
|
|
659
|
+
const oSource = isOutlookObject(oOptions && oOptions.emailMessage) ? oOptions.emailMessage : (isOutlookObject(oOptions) ? oOptions : {});
|
|
660
|
+
const oMessage = Object.assign({}, oSource);
|
|
661
|
+
|
|
662
|
+
setOutlookIfDefined(oMessage, "To", normalizeOutlookList(pickOutlookValue(oSource.To, oSource.to)));
|
|
663
|
+
setOutlookIfDefined(oMessage, "Cc", normalizeOutlookList(pickOutlookValue(oSource.Cc, oSource.cc)));
|
|
664
|
+
setOutlookIfDefined(oMessage, "Bcc", normalizeOutlookList(pickOutlookValue(oSource.Bcc, oSource.bcc)));
|
|
665
|
+
setOutlookIfDefined(oMessage, "ReplyTo", normalizeOutlookList(pickOutlookValue(oSource.ReplyTo, oSource.replyTo)));
|
|
666
|
+
setOutlookIfDefined(oMessage, "From", pickOutlookValue(oSource.From, oSource.from));
|
|
667
|
+
setOutlookIfDefined(oMessage, "Subject", pickOutlookValue(oSource.Subject, oSource.subject));
|
|
668
|
+
setOutlookIfDefined(oMessage, "Body", pickOutlookValue(oSource.Body, oSource.body));
|
|
669
|
+
setOutlookIfDefined(oMessage, "Sensitivity", pickOutlookValue(oSource.Sensitivity, oSource.sensitivity));
|
|
670
|
+
setOutlookIfDefined(oMessage, "Importance", pickOutlookValue(oSource.Importance, oSource.importance));
|
|
671
|
+
setOutlookIfDefined(oMessage, "Attachments", normalizeOutlookAttachments(pickOutlookValue(oSource.Attachments, oSource.attachments)));
|
|
672
|
+
|
|
673
|
+
if (bSupportsPlainText) {
|
|
674
|
+
setOutlookIfDefined(oMessage, "IsHtml", pickOutlookValue(oSource.IsHtml, oSource.isHtml));
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
return oMessage;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
function normalizeSharedMailboxMessage(sSharedMailbox, oOptions, bSupportsPlainText) {
|
|
681
|
+
const oSource = isOutlookObject(oOptions && oOptions.emailMessage) ? oOptions.emailMessage : (isOutlookObject(oOptions) ? oOptions : {});
|
|
682
|
+
const oMessage = normalizeEmailMessage(oOptions, bSupportsPlainText);
|
|
683
|
+
setOutlookIfDefined(oMessage, "MailboxAddress", pickOutlookValue(oSource.MailboxAddress, oSource.mailboxAddress, sSharedMailbox));
|
|
684
|
+
return oMessage;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
function normalizeReplyParameters(oOptions, bSupportsPlainText) {
|
|
688
|
+
const oSource = isOutlookObject(oOptions && oOptions.replyParameters) ? oOptions.replyParameters : (isOutlookObject(oOptions) ? oOptions : {});
|
|
689
|
+
const oReply = Object.assign({}, oSource);
|
|
690
|
+
|
|
691
|
+
setOutlookIfDefined(oReply, "To", normalizeOutlookList(pickOutlookValue(oSource.To, oSource.to)));
|
|
692
|
+
setOutlookIfDefined(oReply, "Cc", normalizeOutlookList(pickOutlookValue(oSource.Cc, oSource.cc)));
|
|
693
|
+
setOutlookIfDefined(oReply, "Bcc", normalizeOutlookList(pickOutlookValue(oSource.Bcc, oSource.bcc)));
|
|
694
|
+
setOutlookIfDefined(oReply, "Subject", pickOutlookValue(oSource.Subject, oSource.subject));
|
|
695
|
+
setOutlookIfDefined(oReply, "Body", pickOutlookValue(oSource.Body, oSource.body, oSource.comment));
|
|
696
|
+
setOutlookIfDefined(oReply, "ReplyAll", pickOutlookValue(oSource.ReplyAll, oSource.replyAll));
|
|
697
|
+
setOutlookIfDefined(oReply, "Importance", pickOutlookValue(oSource.Importance, oSource.importance));
|
|
698
|
+
setOutlookIfDefined(oReply, "Attachments", normalizeOutlookAttachments(pickOutlookValue(oSource.Attachments, oSource.attachments)));
|
|
699
|
+
|
|
700
|
+
if (bSupportsPlainText) {
|
|
701
|
+
setOutlookIfDefined(oReply, "IsHtml", pickOutlookValue(oSource.IsHtml, oSource.isHtml));
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
return oReply;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
function normalizeForwardBody(oOptions) {
|
|
708
|
+
const oSource = isOutlookObject(oOptions && oOptions.body) ? oOptions.body : (isOutlookObject(oOptions) ? oOptions : {});
|
|
709
|
+
const oBody = Object.assign({}, oSource);
|
|
710
|
+
setOutlookIfDefined(oBody, "ToRecipients", normalizeOutlookList(pickOutlookValue(oSource.ToRecipients, oSource.toRecipients, oSource.To, oSource.to)));
|
|
711
|
+
setOutlookIfDefined(oBody, "Comment", pickOutlookValue(oSource.Comment, oSource.comment));
|
|
712
|
+
return oBody;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
function normalizeEventItem(oOptions, bApplyDefaults) {
|
|
716
|
+
const oSource = isOutlookObject(oOptions && oOptions.item) ? oOptions.item : (isOutlookObject(oOptions) ? oOptions : {});
|
|
717
|
+
const oItem = Object.assign({}, oSource);
|
|
718
|
+
|
|
719
|
+
setOutlookIfDefined(oItem, "subject", pickOutlookValue(oSource.subject, oSource.Subject, oSource.title));
|
|
720
|
+
setOutlookIfDefined(oItem, "start", pickOutlookValue(oSource.start, oSource.Start, oSource.startWithTimeZone));
|
|
721
|
+
setOutlookIfDefined(oItem, "end", pickOutlookValue(oSource.end, oSource.End, oSource.endWithTimeZone));
|
|
722
|
+
setOutlookIfDefined(oItem, "timeZone", pickOutlookValue(oSource.timeZone, oSource.TimeZone, oSource.timezone, oSource.StartTimeZone, oSource.EndTimeZone));
|
|
723
|
+
setOutlookIfDefined(oItem, "requiredAttendees", normalizeOutlookList(pickOutlookValue(oSource.requiredAttendees, oSource.RequiredAttendees, oSource.attendees)));
|
|
724
|
+
setOutlookIfDefined(oItem, "optionalAttendees", normalizeOutlookList(pickOutlookValue(oSource.optionalAttendees, oSource.OptionalAttendees)));
|
|
725
|
+
setOutlookIfDefined(oItem, "resourceAttendees", normalizeOutlookList(pickOutlookValue(oSource.resourceAttendees, oSource.ResourceAttendees)));
|
|
726
|
+
setOutlookIfDefined(oItem, "body", pickOutlookValue(oSource.body, oSource.Body));
|
|
727
|
+
setOutlookIfDefined(oItem, "categories", pickOutlookValue(oSource.categories, oSource.Categories));
|
|
728
|
+
setOutlookIfDefined(oItem, "location", pickOutlookValue(oSource.location, oSource.Location));
|
|
729
|
+
setOutlookIfDefined(oItem, "importance", pickOutlookValue(oSource.importance, oSource.Importance));
|
|
730
|
+
setOutlookIfDefined(oItem, "isAllDay", pickOutlookValue(oSource.isAllDay, oSource.IsAllDay));
|
|
731
|
+
setOutlookIfDefined(oItem, "recurrence", pickOutlookValue(oSource.recurrence, oSource.Recurrence));
|
|
732
|
+
setOutlookIfDefined(oItem, "selectedDaysOfWeek", pickOutlookValue(oSource.selectedDaysOfWeek, oSource.SelectedDaysOfWeek));
|
|
733
|
+
setOutlookIfDefined(oItem, "recurrenceEnd", pickOutlookValue(oSource.recurrenceEnd, oSource.RecurrenceEnd));
|
|
734
|
+
setOutlookIfDefined(oItem, "numberOfOccurences", pickOutlookValue(oSource.numberOfOccurences, oSource.numberOfOccurrences, oSource.NumberOfOccurrences));
|
|
735
|
+
setOutlookIfDefined(oItem, "reminderMinutesBeforeStart", pickOutlookValue(oSource.reminderMinutesBeforeStart, oSource.Reminder, oSource.reminder));
|
|
736
|
+
setOutlookIfDefined(oItem, "isReminderOn", pickOutlookValue(oSource.isReminderOn, oSource.IsReminderOn));
|
|
737
|
+
setOutlookIfDefined(oItem, "showAs", pickOutlookValue(oSource.showAs, oSource.ShowAs));
|
|
738
|
+
setOutlookIfDefined(oItem, "responseRequested", pickOutlookValue(oSource.responseRequested, oSource.ResponseRequested));
|
|
739
|
+
setOutlookIfDefined(oItem, "sensitivity", pickOutlookValue(oSource.sensitivity, oSource.Sensitivity));
|
|
740
|
+
|
|
741
|
+
if (bApplyDefaults && oItem.timeZone === undefined) {
|
|
742
|
+
oItem.timeZone = "";
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
return oItem;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
function normalizeEmailQuery(oOptions) {
|
|
749
|
+
const oSource = isOutlookObject(oOptions) ? oOptions : {};
|
|
750
|
+
const oQuery = {};
|
|
751
|
+
|
|
752
|
+
setOutlookIfDefined(oQuery, "folderPath", pickOutlookValue(oSource.folderPath, oSource.folderId));
|
|
753
|
+
setOutlookIfDefined(oQuery, "to", normalizeOutlookList(pickOutlookValue(oSource.to, oSource.To)));
|
|
754
|
+
setOutlookIfDefined(oQuery, "cc", normalizeOutlookList(pickOutlookValue(oSource.cc, oSource.Cc)));
|
|
755
|
+
setOutlookIfDefined(oQuery, "toOrCc", normalizeOutlookList(pickOutlookValue(oSource.toOrCc, oSource.ToOrCc)));
|
|
756
|
+
setOutlookIfDefined(oQuery, "from", pickOutlookValue(oSource.from, oSource.From));
|
|
757
|
+
setOutlookIfDefined(oQuery, "importance", pickOutlookValue(oSource.importance, oSource.Importance));
|
|
758
|
+
setOutlookIfDefined(oQuery, "fetchOnlyWithAttachment", pickOutlookValue(oSource.fetchOnlyWithAttachment, oSource.hasAttachment));
|
|
759
|
+
setOutlookIfDefined(oQuery, "subjectFilter", pickOutlookValue(oSource.subjectFilter, oSource.subject));
|
|
760
|
+
setOutlookIfDefined(oQuery, "fetchOnlyUnread", pickOutlookValue(oSource.fetchOnlyUnread, oSource.unreadOnly));
|
|
761
|
+
setOutlookIfDefined(oQuery, "fetchOnlyFlagged", pickOutlookValue(oSource.fetchOnlyFlagged, oSource.flaggedOnly));
|
|
762
|
+
setOutlookIfDefined(oQuery, "mailboxAddress", pickOutlookValue(oSource.mailboxAddress, oSource.MailboxAddress));
|
|
763
|
+
setOutlookIfDefined(oQuery, "includeAttachments", pickOutlookValue(oSource.includeAttachments, oSource.IncludeAttachments));
|
|
764
|
+
setOutlookIfDefined(oQuery, "searchQuery", pickOutlookValue(oSource.searchQuery, oSource.search, oSource.SearchQuery));
|
|
765
|
+
setOutlookIfDefined(oQuery, "top", pickOutlookValue(oSource.top, oSource.Top));
|
|
766
|
+
return oQuery;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
function normalizeFlagBody(oOptions) {
|
|
770
|
+
const oSource = isOutlookObject(oOptions) ? oOptions : {};
|
|
771
|
+
if (isOutlookObject(oSource.body)) {
|
|
772
|
+
return oSource.body;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
if (isOutlookObject(oSource.flag)) {
|
|
776
|
+
return { flag: oSource.flag };
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
const sFlagStatus = pickOutlookValue(oSource.flagStatus, oSource.status);
|
|
780
|
+
if (sFlagStatus) {
|
|
781
|
+
return { flag: { flagStatus: sFlagStatus } };
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
return undefined;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
function normalizeMarkAsReadBody(oOptions) {
|
|
788
|
+
const oSource = isOutlookObject(oOptions) ? oOptions : {};
|
|
789
|
+
if (isOutlookObject(oSource.body)) {
|
|
790
|
+
return oSource.body;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
return { isRead: pickOutlookValue(oSource.isRead, true) };
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
// ── Internal: execute a connector operation ────────────────────
|
|
797
|
+
async function execOutlookOp(operationName, parameters) {
|
|
798
|
+
const client = await initOutlookClient();
|
|
799
|
+
const aErrors = [];
|
|
800
|
+
|
|
801
|
+
for (let iIndex = 0; iIndex < DATA_SOURCE_CANDIDATES.length; iIndex += 1) {
|
|
802
|
+
const sDataSourceName = DATA_SOURCE_CANDIDATES[iIndex];
|
|
803
|
+
|
|
804
|
+
try {
|
|
805
|
+
const result = await client.executeAsync({
|
|
806
|
+
connectorOperation: {
|
|
807
|
+
tableName: sDataSourceName,
|
|
808
|
+
operationName,
|
|
809
|
+
parameters,
|
|
810
|
+
},
|
|
811
|
+
});
|
|
812
|
+
|
|
813
|
+
return unwrapOutlookResult(result);
|
|
814
|
+
} catch (oErr) {
|
|
815
|
+
const sMessage = stringifyOutlookError(oErr);
|
|
816
|
+
aErrors.push(sDataSourceName + ": " + sMessage);
|
|
817
|
+
|
|
818
|
+
if (sMessage.indexOf("Connection reference not found") === -1) {
|
|
819
|
+
throw oErr;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
throw new Error("No Outlook connection reference matched. Tried: " + aErrors.join(" || "));
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
// ── Generic: call any Outlook connector operation ──────────────
|
|
828
|
+
export async function callOutlookOperation(sOperationName, oParameters) {
|
|
829
|
+
return _dbgWrap('callOutlookOperation', [sOperationName, oParameters], async function() {
|
|
830
|
+
return execOutlookOp(sOperationName, oParameters);
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
// ── Send Email ─────────────────────────────────────────────────
|
|
835
|
+
export async function sendEmail(oOptions = {}) {
|
|
836
|
+
return _dbgWrap('sendEmail', [oOptions], async function() {
|
|
837
|
+
const bUsePlainText = pickOutlookValue(oOptions.isHtml, oOptions.emailMessage && oOptions.emailMessage.IsHtml) === false;
|
|
838
|
+
const oMessage = normalizeEmailMessage(oOptions, bUsePlainText);
|
|
839
|
+
return execOutlookOp(bUsePlainText ? "SendEmail" : "SendEmailV2", { emailMessage: oMessage });
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
// ── Forward Email ──────────────────────────────────────────────
|
|
844
|
+
export async function forwardEmail(sMessageId, oOptions = {}) {
|
|
845
|
+
return _dbgWrap('forwardEmail', [sMessageId, oOptions], async function() {
|
|
846
|
+
if (isOutlookObject(sMessageId)) {
|
|
847
|
+
oOptions = sMessageId;
|
|
848
|
+
sMessageId = pickOutlookValue(oOptions.messageId, oOptions.id);
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
const sMailboxAddress = pickOutlookValue(oOptions.mailboxAddress, oOptions.MailboxAddress);
|
|
852
|
+
const sOperationName = sMailboxAddress ? "ForwardEmail_V2" : "ForwardEmail";
|
|
853
|
+
const oParameters = {
|
|
854
|
+
message_id: sMessageId,
|
|
855
|
+
body: normalizeForwardBody(oOptions),
|
|
856
|
+
};
|
|
857
|
+
setOutlookIfDefined(oParameters, "mailboxAddress", sMailboxAddress);
|
|
858
|
+
return execOutlookOp(sOperationName, oParameters);
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
// ── Reply to Email ─────────────────────────────────────────────
|
|
863
|
+
export async function replyToEmail(sMessageId, oOptions = {}) {
|
|
864
|
+
return _dbgWrap('replyToEmail', [sMessageId, oOptions], async function() {
|
|
865
|
+
if (isOutlookObject(sMessageId)) {
|
|
866
|
+
oOptions = sMessageId;
|
|
867
|
+
sMessageId = pickOutlookValue(oOptions.messageId, oOptions.id);
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
const bUsePlainText = pickOutlookValue(oOptions.isHtml, oOptions.replyParameters && oOptions.replyParameters.IsHtml) === false;
|
|
871
|
+
const oParameters = {
|
|
872
|
+
messageId: sMessageId,
|
|
873
|
+
replyParameters: normalizeReplyParameters(oOptions, bUsePlainText),
|
|
874
|
+
};
|
|
875
|
+
setOutlookIfDefined(oParameters, "mailboxAddress", pickOutlookValue(oOptions.mailboxAddress, oOptions.MailboxAddress));
|
|
876
|
+
return execOutlookOp(bUsePlainText ? "ReplyToV2" : "ReplyToV3", oParameters);
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
// ── List Emails ────────────────────────────────────────────────
|
|
881
|
+
export async function listEmails(oOptions = {}) {
|
|
882
|
+
return _dbgWrap('listEmails', [oOptions], async function() {
|
|
883
|
+
const iVersion = pickOutlookValue(oOptions.version, 3);
|
|
884
|
+
const oParameters = normalizeEmailQuery(Object.assign({}, oOptions, { folderId: pickOutlookValue(oOptions.folderId, "Inbox") }));
|
|
885
|
+
if (oParameters.top === undefined) {
|
|
886
|
+
oParameters.top = 10;
|
|
887
|
+
}
|
|
888
|
+
void oOptions.skip;
|
|
889
|
+
return execOutlookOp(iVersion === 2 ? "GetEmailsV2" : "GetEmailsV3", oParameters);
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
// ── Send from Shared Mailbox ───────────────────────────────────
|
|
894
|
+
export async function sendFromSharedMailbox(sSharedMailbox, oOptions = {}) {
|
|
895
|
+
return _dbgWrap('sendFromSharedMailbox', [sSharedMailbox, oOptions], async function() {
|
|
896
|
+
if (isOutlookObject(sSharedMailbox)) {
|
|
897
|
+
oOptions = sSharedMailbox;
|
|
898
|
+
sSharedMailbox = pickOutlookValue(oOptions.mailboxAddress, oOptions.MailboxAddress);
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
const bUsePlainText = pickOutlookValue(oOptions.isHtml, oOptions.emailMessage && oOptions.emailMessage.IsHtml) === false;
|
|
902
|
+
const oMessage = normalizeSharedMailboxMessage(sSharedMailbox, oOptions, bUsePlainText);
|
|
903
|
+
return execOutlookOp(bUsePlainText ? "SharedMailboxSendEmail" : "SharedMailboxSendEmailV2", { emailMessage: oMessage });
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
// ── Move Email ─────────────────────────────────────────────────
|
|
908
|
+
export async function moveEmail(sMessageId, sDestinationFolderId, oOptions) {
|
|
909
|
+
return _dbgWrap('moveEmail', [sMessageId, sDestinationFolderId, oOptions], async function() {
|
|
910
|
+
if (isOutlookObject(sDestinationFolderId)) {
|
|
911
|
+
oOptions = sDestinationFolderId;
|
|
912
|
+
sDestinationFolderId = pickOutlookValue(oOptions.folderPath, oOptions.folderId, oOptions.destinationFolderId);
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
oOptions = isOutlookObject(oOptions) ? oOptions : {};
|
|
916
|
+
return execOutlookOp("MoveV2", {
|
|
917
|
+
messageId: sMessageId,
|
|
918
|
+
folderPath: sDestinationFolderId,
|
|
919
|
+
mailboxAddress: pickOutlookValue(oOptions.mailboxAddress, oOptions.MailboxAddress),
|
|
920
|
+
});
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
// ── Delete Email ───────────────────────────────────────────────
|
|
925
|
+
export async function deleteEmail(sMessageId, oOptions) {
|
|
926
|
+
return _dbgWrap('deleteEmail', [sMessageId, oOptions], async function() {
|
|
927
|
+
if (isOutlookObject(sMessageId)) {
|
|
928
|
+
oOptions = sMessageId;
|
|
929
|
+
sMessageId = pickOutlookValue(oOptions.messageId, oOptions.id);
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
oOptions = isOutlookObject(oOptions) ? oOptions : {};
|
|
933
|
+
const sMailboxAddress = pickOutlookValue(oOptions.mailboxAddress, oOptions.MailboxAddress);
|
|
934
|
+
const sOperationName = sMailboxAddress ? "DeleteEmail_V2" : "DeleteEmail";
|
|
935
|
+
const oParameters = { messageId: sMessageId };
|
|
936
|
+
setOutlookIfDefined(oParameters, "mailboxAddress", sMailboxAddress);
|
|
937
|
+
return execOutlookOp(sOperationName, oParameters);
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
// ── Create Event ───────────────────────────────────────────────
|
|
942
|
+
export async function createEvent(oOptions = {}) {
|
|
943
|
+
return _dbgWrap('createEvent', [oOptions], async function() {
|
|
944
|
+
const oItem = normalizeEventItem(oOptions, true);
|
|
945
|
+
|
|
946
|
+
return execOutlookOp("V4CalendarPostItem", {
|
|
947
|
+
table: pickOutlookValue(oOptions.calendarId, oOptions.table, "Calendar"),
|
|
948
|
+
item: oItem,
|
|
949
|
+
});
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
// ── List Events ────────────────────────────────────────────────
|
|
954
|
+
export async function listEvents(oOptions = {}) {
|
|
955
|
+
return _dbgWrap('listEvents', [oOptions], async function() {
|
|
956
|
+
return execOutlookOp("V4CalendarGetItems", {
|
|
957
|
+
table: pickOutlookValue(oOptions.calendarId, oOptions.table, "Calendar"),
|
|
958
|
+
$filter: pickOutlookValue(oOptions.filter, oOptions.$filter),
|
|
959
|
+
$orderby: pickOutlookValue(oOptions.orderBy, oOptions.$orderby),
|
|
960
|
+
$top: pickOutlookValue(oOptions.top, oOptions.$top),
|
|
961
|
+
$skip: pickOutlookValue(oOptions.skip, oOptions.$skip),
|
|
962
|
+
});
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
// ── Edit Event ─────────────────────────────────────────────────
|
|
967
|
+
export async function editEvent(sEventId, oChangedFields, sCalendarId) {
|
|
968
|
+
return _dbgWrap('editEvent', [sEventId, oChangedFields, sCalendarId], async function() {
|
|
969
|
+
let oOptions = isOutlookObject(oChangedFields) ? oChangedFields : {};
|
|
970
|
+
if (isOutlookObject(sEventId)) {
|
|
971
|
+
oOptions = sEventId;
|
|
972
|
+
sEventId = pickOutlookValue(oOptions.eventId, oOptions.id);
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
return execOutlookOp("V4CalendarPatchItem", {
|
|
976
|
+
table: pickOutlookValue(oOptions.calendarId, oOptions.table, sCalendarId, "Calendar"),
|
|
977
|
+
id: sEventId,
|
|
978
|
+
item: normalizeEventItem(oOptions, false),
|
|
979
|
+
});
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
// ── Delete Event ───────────────────────────────────────────────
|
|
984
|
+
export async function deleteEvent(sEventId, sCalendarId, oOptions) {
|
|
985
|
+
return _dbgWrap('deleteEvent', [sEventId, sCalendarId, oOptions], async function() {
|
|
986
|
+
if (isOutlookObject(sCalendarId)) {
|
|
987
|
+
oOptions = sCalendarId;
|
|
988
|
+
sCalendarId = pickOutlookValue(oOptions.calendarId, oOptions.table);
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
return execOutlookOp("CalendarDeleteItem", {
|
|
992
|
+
table: pickOutlookValue(sCalendarId, oOptions && oOptions.calendarId, oOptions && oOptions.table, "Calendar"),
|
|
993
|
+
id: sEventId,
|
|
994
|
+
});
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
export async function getEmail(sMessageId, oOptions = {}) {
|
|
999
|
+
return _dbgWrap('getEmail', [sMessageId, oOptions], async function() {
|
|
1000
|
+
if (isOutlookObject(sMessageId)) {
|
|
1001
|
+
oOptions = sMessageId;
|
|
1002
|
+
sMessageId = pickOutlookValue(oOptions.messageId, oOptions.id);
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
const bUseV2 = pickOutlookValue(oOptions.version, 2) !== 1;
|
|
1006
|
+
const oParameters = {
|
|
1007
|
+
messageId: sMessageId,
|
|
1008
|
+
mailboxAddress: pickOutlookValue(oOptions.mailboxAddress, oOptions.MailboxAddress),
|
|
1009
|
+
includeAttachments: pickOutlookValue(oOptions.includeAttachments, oOptions.IncludeAttachments),
|
|
1010
|
+
internetMessageId: pickOutlookValue(oOptions.internetMessageId, oOptions.InternetMessageId),
|
|
1011
|
+
};
|
|
1012
|
+
if (bUseV2) {
|
|
1013
|
+
setOutlookIfDefined(oParameters, "extractSensitivityLabel", oOptions.extractSensitivityLabel);
|
|
1014
|
+
setOutlookIfDefined(oParameters, "fetchSensitivityLabelMetadata", oOptions.fetchSensitivityLabelMetadata);
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
return execOutlookOp(bUseV2 ? "GetEmailV2" : "GetEmail", oParameters);
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
export async function draftEmail(oOptions = {}) {
|
|
1022
|
+
return _dbgWrap('draftEmail', [oOptions], async function() {
|
|
1023
|
+
return execOutlookOp("DraftEmail", {
|
|
1024
|
+
draftMessage: normalizeEmailMessage(oOptions, false),
|
|
1025
|
+
messageId: pickOutlookValue(oOptions.messageId, oOptions.id),
|
|
1026
|
+
draftType: pickOutlookValue(oOptions.draftType, oOptions.type),
|
|
1027
|
+
comment: pickOutlookValue(oOptions.comment, oOptions.Comment),
|
|
1028
|
+
});
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
export async function updateDraftEmail(sMessageId, oOptions = {}) {
|
|
1033
|
+
return _dbgWrap('updateDraftEmail', [sMessageId, oOptions], async function() {
|
|
1034
|
+
if (isOutlookObject(sMessageId)) {
|
|
1035
|
+
oOptions = sMessageId;
|
|
1036
|
+
sMessageId = pickOutlookValue(oOptions.messageId, oOptions.id);
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
return execOutlookOp("UpdateDraftEmail", {
|
|
1040
|
+
messageId: sMessageId,
|
|
1041
|
+
draftMessage: normalizeEmailMessage(oOptions, false),
|
|
1042
|
+
});
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
export async function sendDraftEmail(sMessageId) {
|
|
1047
|
+
return _dbgWrap('sendDraftEmail', [sMessageId], async function() {
|
|
1048
|
+
if (isOutlookObject(sMessageId)) {
|
|
1049
|
+
sMessageId = pickOutlookValue(sMessageId.messageId, sMessageId.id);
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
return execOutlookOp("SendDraftEmail", { messageId: sMessageId });
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
export async function markEmailAsRead(sMessageId, oOptions = {}) {
|
|
1057
|
+
return _dbgWrap('markEmailAsRead', [sMessageId, oOptions], async function() {
|
|
1058
|
+
if (isOutlookObject(sMessageId)) {
|
|
1059
|
+
oOptions = sMessageId;
|
|
1060
|
+
sMessageId = pickOutlookValue(oOptions.messageId, oOptions.id);
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
const sMailboxAddress = pickOutlookValue(oOptions.mailboxAddress, oOptions.MailboxAddress);
|
|
1064
|
+
const bUseLegacy = pickOutlookValue(oOptions.version, 3) === 1 && !sMailboxAddress && !oOptions.body && oOptions.isRead === undefined;
|
|
1065
|
+
if (bUseLegacy) {
|
|
1066
|
+
return execOutlookOp("MarkAsRead", { messageId: sMessageId });
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
return execOutlookOp("MarkAsRead_V3", {
|
|
1070
|
+
messageId: sMessageId,
|
|
1071
|
+
mailboxAddress: sMailboxAddress,
|
|
1072
|
+
body: normalizeMarkAsReadBody(oOptions),
|
|
1073
|
+
});
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
export async function updateEmailFlag(sMessageId, oOptions = {}) {
|
|
1078
|
+
return _dbgWrap('updateEmailFlag', [sMessageId, oOptions], async function() {
|
|
1079
|
+
if (isOutlookObject(sMessageId)) {
|
|
1080
|
+
oOptions = sMessageId;
|
|
1081
|
+
sMessageId = pickOutlookValue(oOptions.messageId, oOptions.id);
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
const sMailboxAddress = pickOutlookValue(oOptions.mailboxAddress, oOptions.MailboxAddress);
|
|
1085
|
+
const oBody = normalizeFlagBody(oOptions);
|
|
1086
|
+
if (!sMailboxAddress && !oBody) {
|
|
1087
|
+
return execOutlookOp("Flag", { messageId: sMessageId });
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
return execOutlookOp("Flag_V2", {
|
|
1091
|
+
messageId: sMessageId,
|
|
1092
|
+
mailboxAddress: sMailboxAddress,
|
|
1093
|
+
body: oBody,
|
|
1094
|
+
});
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
export async function getEmailAttachment(sMessageId, sAttachmentId, oOptions = {}) {
|
|
1099
|
+
return _dbgWrap('getEmailAttachment', [sMessageId, sAttachmentId, oOptions], async function() {
|
|
1100
|
+
if (isOutlookObject(sMessageId)) {
|
|
1101
|
+
oOptions = sMessageId;
|
|
1102
|
+
sMessageId = pickOutlookValue(oOptions.messageId, oOptions.id);
|
|
1103
|
+
sAttachmentId = pickOutlookValue(oOptions.attachmentId, oOptions.AttachmentId);
|
|
1104
|
+
} else if (isOutlookObject(sAttachmentId)) {
|
|
1105
|
+
oOptions = sAttachmentId;
|
|
1106
|
+
sAttachmentId = pickOutlookValue(oOptions.attachmentId, oOptions.AttachmentId);
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
const sMailboxAddress = pickOutlookValue(oOptions.mailboxAddress, oOptions.MailboxAddress);
|
|
1110
|
+
const bUseV2 = !!sMailboxAddress || oOptions.extractSensitivityLabel === true || oOptions.fetchSensitivityLabelMetadata === true;
|
|
1111
|
+
const oParameters = {
|
|
1112
|
+
messageId: sMessageId,
|
|
1113
|
+
attachmentId: sAttachmentId,
|
|
1114
|
+
};
|
|
1115
|
+
if (bUseV2) {
|
|
1116
|
+
setOutlookIfDefined(oParameters, "mailboxAddress", sMailboxAddress);
|
|
1117
|
+
setOutlookIfDefined(oParameters, "extractSensitivityLabel", oOptions.extractSensitivityLabel);
|
|
1118
|
+
setOutlookIfDefined(oParameters, "fetchSensitivityLabelMetadata", oOptions.fetchSensitivityLabelMetadata);
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
return execOutlookOp(bUseV2 ? "GetAttachment_V2" : "GetAttachment", oParameters);
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
export async function listOutlookCategories() {
|
|
1126
|
+
return _dbgWrap('listOutlookCategories', [], async function() {
|
|
1127
|
+
return execOutlookOp("GetOutlookCategoryNames");
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
export async function assignOutlookCategory(sMessageId, sCategory) {
|
|
1132
|
+
return _dbgWrap('assignOutlookCategory', [sMessageId, sCategory], async function() {
|
|
1133
|
+
if (isOutlookObject(sMessageId)) {
|
|
1134
|
+
sCategory = pickOutlookValue(sMessageId.category, sMessageId.categoryName);
|
|
1135
|
+
sMessageId = pickOutlookValue(sMessageId.messageId, sMessageId.id);
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
return execOutlookOp("AssignCategory", { messageId: sMessageId, category: sCategory });
|
|
1139
|
+
});
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
export async function assignOutlookCategoryBulk(aMessageIds, sCategoryName) {
|
|
1143
|
+
return _dbgWrap('assignOutlookCategoryBulk', [aMessageIds, sCategoryName], async function() {
|
|
1144
|
+
if (isOutlookObject(aMessageIds)) {
|
|
1145
|
+
sCategoryName = pickOutlookValue(aMessageIds.categoryName, aMessageIds.category);
|
|
1146
|
+
aMessageIds = pickOutlookValue(aMessageIds.messageIds, aMessageIds.ids);
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
return execOutlookOp("AssignCategoryBulk", { messageIds: aMessageIds, categoryName: sCategoryName });
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
export async function listCalendars(oOptions = {}) {
|
|
1154
|
+
return _dbgWrap('listCalendars', [oOptions], async function() {
|
|
1155
|
+
return execOutlookOp("CalendarGetTables_V2", {
|
|
1156
|
+
skip: oOptions.skip,
|
|
1157
|
+
top: oOptions.top,
|
|
1158
|
+
orderBy: pickOutlookValue(oOptions.orderBy, oOptions.$orderby),
|
|
1159
|
+
});
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
export async function getEvent(sEventId, sCalendarId, oOptions) {
|
|
1164
|
+
return _dbgWrap('getEvent', [sEventId, sCalendarId, oOptions], async function() {
|
|
1165
|
+
if (isOutlookObject(sEventId)) {
|
|
1166
|
+
oOptions = sEventId;
|
|
1167
|
+
sEventId = pickOutlookValue(oOptions.eventId, oOptions.id);
|
|
1168
|
+
sCalendarId = pickOutlookValue(oOptions.calendarId, oOptions.table);
|
|
1169
|
+
} else if (isOutlookObject(sCalendarId)) {
|
|
1170
|
+
oOptions = sCalendarId;
|
|
1171
|
+
sCalendarId = pickOutlookValue(oOptions.calendarId, oOptions.table);
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
return execOutlookOp("V3CalendarGetItem", {
|
|
1175
|
+
table: pickOutlookValue(sCalendarId, oOptions && oOptions.calendarId, oOptions && oOptions.table, "Calendar"),
|
|
1176
|
+
id: sEventId,
|
|
1177
|
+
});
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
export async function getCalendarView(oOptions = {}) {
|
|
1182
|
+
return _dbgWrap('getCalendarView', [oOptions], async function() {
|
|
1183
|
+
return execOutlookOp("GetEventsCalendarViewV3", {
|
|
1184
|
+
calendarId: pickOutlookValue(oOptions.calendarId, oOptions.table, "Calendar"),
|
|
1185
|
+
startDateTimeUtc: pickOutlookValue(oOptions.startDateTimeUtc, oOptions.start, oOptions.startDateTime),
|
|
1186
|
+
endDateTimeUtc: pickOutlookValue(oOptions.endDateTimeUtc, oOptions.end, oOptions.endDateTime),
|
|
1187
|
+
$filter: pickOutlookValue(oOptions.filter, oOptions.$filter),
|
|
1188
|
+
$orderby: pickOutlookValue(oOptions.orderBy, oOptions.$orderby),
|
|
1189
|
+
$top: pickOutlookValue(oOptions.top, oOptions.$top),
|
|
1190
|
+
$skip: pickOutlookValue(oOptions.skip, oOptions.$skip),
|
|
1191
|
+
search: oOptions.search,
|
|
1192
|
+
});
|
|
1193
|
+
});
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
export async function respondToEventInvite(sEventId, sResponse, oOptions = {}) {
|
|
1197
|
+
return _dbgWrap('respondToEventInvite', [sEventId, sResponse, oOptions], async function() {
|
|
1198
|
+
if (isOutlookObject(sEventId)) {
|
|
1199
|
+
oOptions = sEventId;
|
|
1200
|
+
sEventId = pickOutlookValue(oOptions.eventId, oOptions.id);
|
|
1201
|
+
sResponse = pickOutlookValue(oOptions.response, oOptions.action);
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
return execOutlookOp("RespondToEvent_V2", {
|
|
1205
|
+
event_id: sEventId,
|
|
1206
|
+
response: sResponse,
|
|
1207
|
+
body: isOutlookObject(oOptions.body) ? oOptions.body : {
|
|
1208
|
+
Comment: pickOutlookValue(oOptions.comment, oOptions.Comment),
|
|
1209
|
+
SendResponse: pickOutlookValue(oOptions.sendResponse, oOptions.SendResponse),
|
|
1210
|
+
},
|
|
1211
|
+
});
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
export async function listRoomLists() {
|
|
1216
|
+
return _dbgWrap('listRoomLists', [], async function() {
|
|
1217
|
+
return execOutlookOp("GetRoomLists_V2");
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
export async function listRooms() {
|
|
1222
|
+
return _dbgWrap('listRooms', [], async function() {
|
|
1223
|
+
return execOutlookOp("GetRooms_V2");
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
export async function listRoomsInRoomList(sRoomList) {
|
|
1228
|
+
return _dbgWrap('listRoomsInRoomList', [sRoomList], async function() {
|
|
1229
|
+
if (isOutlookObject(sRoomList)) {
|
|
1230
|
+
sRoomList = pickOutlookValue(sRoomList.roomList, sRoomList.id, sRoomList.name);
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
return execOutlookOp("GetRoomsInRoomList_V2", { room_list: sRoomList });
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
export async function findMeetingTimes(oRequest = {}) {
|
|
1238
|
+
return _dbgWrap('findMeetingTimes', [oRequest], async function() {
|
|
1239
|
+
return execOutlookOp("FindMeetingTimes_V2", {
|
|
1240
|
+
body: isOutlookObject(oRequest.body) ? oRequest.body : oRequest,
|
|
1241
|
+
});
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
export async function setAutomaticReplies(oSettings = {}) {
|
|
1246
|
+
return _dbgWrap('setAutomaticReplies', [oSettings], async function() {
|
|
1247
|
+
const bUseLegacy = oSettings.version === 1 || oSettings.clientSetting || oSettings.Status || oSettings.ExternalAudience;
|
|
1248
|
+
return execOutlookOp(bUseLegacy ? "SetAutomaticRepliesSetting" : "SetAutomaticRepliesSetting_V2", bUseLegacy ? {
|
|
1249
|
+
clientSetting: isOutlookObject(oSettings.clientSetting) ? oSettings.clientSetting : oSettings,
|
|
1250
|
+
} : {
|
|
1251
|
+
body: isOutlookObject(oSettings.body) ? oSettings.body : oSettings,
|
|
1252
|
+
});
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
export async function getMailTips(oRequest) {
|
|
1257
|
+
return _dbgWrap('getMailTips', [oRequest], async function() {
|
|
1258
|
+
if (typeof oRequest === "string") {
|
|
1259
|
+
return execOutlookOp("GetMailTips", { mailboxAddress: oRequest });
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
const oOptions = isOutlookObject(oRequest) ? oRequest : {};
|
|
1263
|
+
if (oOptions.body || !oOptions.mailboxAddress) {
|
|
1264
|
+
return execOutlookOp("GetMailTips_V2", {
|
|
1265
|
+
body: isOutlookObject(oOptions.body) ? oOptions.body : oOptions,
|
|
1266
|
+
});
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
return execOutlookOp("GetMailTips", { mailboxAddress: oOptions.mailboxAddress });
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
export async function listContactFolders() {
|
|
1274
|
+
return _dbgWrap('listContactFolders', [], async function() {
|
|
1275
|
+
return execOutlookOp("ContactGetTablesV2");
|
|
1276
|
+
});
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
export async function listContacts(sFolderId, oOptions) {
|
|
1280
|
+
return _dbgWrap('listContacts', [sFolderId, oOptions], async function() {
|
|
1281
|
+
if (isOutlookObject(sFolderId)) {
|
|
1282
|
+
oOptions = sFolderId;
|
|
1283
|
+
sFolderId = pickOutlookValue(oOptions.folderId, oOptions.folder, oOptions.table);
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
oOptions = isOutlookObject(oOptions) ? oOptions : {};
|
|
1287
|
+
return execOutlookOp("ContactGetItems_V2", {
|
|
1288
|
+
folder: sFolderId,
|
|
1289
|
+
$filter: pickOutlookValue(oOptions.filter, oOptions.$filter),
|
|
1290
|
+
$orderby: pickOutlookValue(oOptions.orderBy, oOptions.$orderby),
|
|
1291
|
+
$top: pickOutlookValue(oOptions.top, oOptions.$top),
|
|
1292
|
+
$skip: pickOutlookValue(oOptions.skip, oOptions.$skip),
|
|
1293
|
+
});
|
|
1294
|
+
});
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
export async function getContact(sFolderId, sContactId, oOptions) {
|
|
1298
|
+
return _dbgWrap('getContact', [sFolderId, sContactId, oOptions], async function() {
|
|
1299
|
+
if (isOutlookObject(sFolderId)) {
|
|
1300
|
+
oOptions = sFolderId;
|
|
1301
|
+
sFolderId = pickOutlookValue(oOptions.folderId, oOptions.folder, oOptions.table);
|
|
1302
|
+
sContactId = pickOutlookValue(oOptions.contactId, oOptions.id);
|
|
1303
|
+
} else if (isOutlookObject(sContactId)) {
|
|
1304
|
+
oOptions = sContactId;
|
|
1305
|
+
sContactId = pickOutlookValue(oOptions.contactId, oOptions.id);
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
return execOutlookOp("ContactGetItem_V2", { folder: sFolderId, id: sContactId });
|
|
1309
|
+
});
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
export async function createContact(sFolderId, oContact) {
|
|
1313
|
+
return _dbgWrap('createContact', [sFolderId, oContact], async function() {
|
|
1314
|
+
if (isOutlookObject(sFolderId)) {
|
|
1315
|
+
oContact = sFolderId;
|
|
1316
|
+
sFolderId = pickOutlookValue(oContact.folderId, oContact.folder, oContact.table);
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
return execOutlookOp("ContactPostItem_V2", {
|
|
1320
|
+
folder: sFolderId,
|
|
1321
|
+
item: isOutlookObject(oContact && oContact.item) ? oContact.item : oContact,
|
|
1322
|
+
});
|
|
1323
|
+
});
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
export async function updateContact(sFolderId, sContactId, oContact) {
|
|
1327
|
+
return _dbgWrap('updateContact', [sFolderId, sContactId, oContact], async function() {
|
|
1328
|
+
if (isOutlookObject(sFolderId)) {
|
|
1329
|
+
oContact = sFolderId;
|
|
1330
|
+
sFolderId = pickOutlookValue(oContact.folderId, oContact.folder, oContact.table);
|
|
1331
|
+
sContactId = pickOutlookValue(oContact.contactId, oContact.id);
|
|
1332
|
+
} else if (isOutlookObject(sContactId)) {
|
|
1333
|
+
oContact = sContactId;
|
|
1334
|
+
sContactId = pickOutlookValue(oContact.contactId, oContact.id);
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
return execOutlookOp("ContactPatchItem_V2", {
|
|
1338
|
+
folder: sFolderId,
|
|
1339
|
+
id: sContactId,
|
|
1340
|
+
item: isOutlookObject(oContact && oContact.item) ? oContact.item : oContact,
|
|
1341
|
+
});
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
export async function deleteContact(sFolderId, sContactId, oOptions) {
|
|
1346
|
+
return _dbgWrap('deleteContact', [sFolderId, sContactId, oOptions], async function() {
|
|
1347
|
+
if (isOutlookObject(sFolderId)) {
|
|
1348
|
+
oOptions = sFolderId;
|
|
1349
|
+
sFolderId = pickOutlookValue(oOptions.folderId, oOptions.folder, oOptions.table);
|
|
1350
|
+
sContactId = pickOutlookValue(oOptions.contactId, oOptions.id);
|
|
1351
|
+
} else if (isOutlookObject(sContactId)) {
|
|
1352
|
+
oOptions = sContactId;
|
|
1353
|
+
sContactId = pickOutlookValue(oOptions.contactId, oOptions.id);
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
return execOutlookOp("ContactDeleteItem_V2", { folder: sFolderId, id: sContactId });
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
export async function callOutlookHttpRequest({ uri, method = "GET", body, contentType, customHeaders } = {}) {
|
|
1361
|
+
return _dbgWrap('callOutlookHttpRequest', [{ uri, method, body, contentType, customHeaders }], async function() {
|
|
1362
|
+
const aHeaders = Array.isArray(customHeaders) ? customHeaders : [];
|
|
1363
|
+
return execOutlookOp("HttpRequest", {
|
|
1364
|
+
Uri: uri,
|
|
1365
|
+
Method: method,
|
|
1366
|
+
Body: body,
|
|
1367
|
+
ContentType: contentType,
|
|
1368
|
+
CustomHeader1: aHeaders[0],
|
|
1369
|
+
CustomHeader2: aHeaders[1],
|
|
1370
|
+
CustomHeader3: aHeaders[2],
|
|
1371
|
+
CustomHeader4: aHeaders[3],
|
|
1372
|
+
CustomHeader5: aHeaders[4],
|
|
1373
|
+
});
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
export async function manageOutlookEmails(queryRequest, sessionId) {
|
|
1378
|
+
return _dbgWrap('manageOutlookEmails', [queryRequest, sessionId], async function() {
|
|
1379
|
+
return execOutlookOp("mcp_EmailsManagement", { queryRequest: queryRequest, sessionId: sessionId });
|
|
1380
|
+
});
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
export async function manageOutlookMeetings(queryRequest, sessionId) {
|
|
1384
|
+
return _dbgWrap('manageOutlookMeetings', [queryRequest, sessionId], async function() {
|
|
1385
|
+
return execOutlookOp("mcp_MeetingManagement", { queryRequest: queryRequest, sessionId: sessionId });
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
export async function manageOutlookContacts(queryRequest, sessionId) {
|
|
1390
|
+
return _dbgWrap('manageOutlookContacts', [queryRequest, sessionId], async function() {
|
|
1391
|
+
return execOutlookOp("mcp_ContactsManagement", { queryRequest: queryRequest, sessionId: sessionId });
|
|
1392
|
+
});
|
|
1393
|
+
}
|