-
Notifications
You must be signed in to change notification settings - Fork 63
/
office.smartalertseventcompletedoptions.yml
342 lines (268 loc) · 14.4 KB
/
office.smartalertseventcompletedoptions.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
### YamlMime:TSType
name: Office.SmartAlertsEventCompletedOptions
uid: 'outlook!Office.SmartAlertsEventCompletedOptions:interface'
package: outlook!
fullName: Office.SmartAlertsEventCompletedOptions
summary: >-
Specifies the behavior of a [Smart Alerts
add-in](https://learn.microsoft.com/office/dev/add-ins/outlook/onmessagesend-onappointmentsend-events) when it
completes processing an `OnMessageSend` or `OnAppointmentSend` event.
remarks: >-
\[ [API set: Mailbox 1.12](/javascript/api/requirement-sets/outlook/outlook-api-requirement-sets) \]
**[Minimum permission level
(Outlook)](https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions)<!--
-->**: **restricted**
**[Applicable Outlook
mode](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points)<!-- -->**:
Compose
#### Examples
```TypeScript
// The following example checks whether a location is specified in an appointment before it's sent.
function onAppointmentSendHandler(event) {
Office.context.mailbox.item.location.getAsync({ asyncContext: event }, asyncResult => {
const event = asyncResult.asyncContext;
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
console.log(asyncResult.error.message);
// If the add-in is unable to retrieve the appointment's location, the appointment isn't sent.
event.completed({ allowEvent: false, errorMessage: "Failed to get the appointment's location." });
return;
}
if (asyncResult.value === "") {
// If no location is specified, the appointment isn't sent and the user is alerted to include a location.
event.completed(
{
allowEvent: false,
cancelLabel: "Add a location",
commandId: "msgComposeOpenPaneButton",
contextData: JSON.stringify({ a: "aValue", b: "bValue" }),
errorMessage: "Don't forget to add a meeting location.",
errorMessageMarkdown: `
Don't forget to add a meeting location.\n\n
**Tip**: For a list of locations,
see [Meeting Locations]("https://www.contoso.com/meeting-locations).`,
sendModeOverride: Office.MailboxEnums.SendModeOverride.PromptUser
}
);
} else {
// If a location is specified, the appointment is sent.
event.completed({ allowEvent: true });
}
});
}
```
isPreview: false
isDeprecated: false
type: interface
properties:
- name: allowEvent
uid: 'outlook!Office.SmartAlertsEventCompletedOptions#allowEvent:member'
package: outlook!
fullName: allowEvent
summary: >-
When you use the [completed
method](https://learn.microsoft.com/javascript/api/outlook/office.mailboxevent#outlook-office-mailboxevent-completed-member(1))
to signal completion of an event handler, this value indicates if the handled event should continue execution or
be canceled. For example, an add-in that handles the `OnMessageSend` or `OnAppointmentSend` event can set
`allowEvent` to `false` to cancel the sending of an item. For a complete sample, see the [Smart Alerts
walkthrough](https://learn.microsoft.com/office/dev/add-ins/outlook/smart-alerts-onmessagesend-walkthrough)<!--
-->.
remarks: >-
\[ [API set: Mailbox 1.12](/javascript/api/requirement-sets/outlook/outlook-api-requirement-sets) \]
**[Minimum permission level
(Outlook)](https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions)<!--
-->**: **restricted**
**[Applicable Outlook
mode](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points)<!--
-->**: Compose
isPreview: false
isDeprecated: false
syntax:
content: 'allowEvent?: boolean;'
return:
type: boolean
- name: cancelLabel
uid: 'outlook!Office.SmartAlertsEventCompletedOptions#cancelLabel:member'
package: outlook!
fullName: cancelLabel
summary: >-
When you use the [completed
method](https://learn.microsoft.com/javascript/api/outlook/office.mailboxevent#outlook-office-mailboxevent-completed-member(1))
to signal completion of an event handler and set its `allowEvent` property to `false`<!-- -->, this property
customizes the text of the **Don't Send** button in the Smart Alerts dialog. Custom text must be 20 characters
or less.
For an example, see the [Smart Alerts
walkthrough](https://learn.microsoft.com/office/dev/add-ins/outlook/smart-alerts-onmessagesend-walkthrough#customize-the-dont-send-button-optional)<!--
-->.
remarks: >-
\[ [API set: Mailbox 1.14](/javascript/api/requirement-sets/outlook/outlook-api-requirement-sets) \]
**[Minimum permission level
(Outlook)](https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions)<!--
-->**: **restricted**
**[Applicable Outlook
mode](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points)<!--
-->**: Compose
isPreview: false
isDeprecated: false
syntax:
content: 'cancelLabel?: string;'
return:
type: string
- name: commandId
uid: 'outlook!Office.SmartAlertsEventCompletedOptions#commandId:member'
package: outlook!
fullName: commandId
summary: >-
When you use the [completed
method](https://learn.microsoft.com/javascript/api/outlook/office.mailboxevent#outlook-office-mailboxevent-completed-member(1))
to signal completion of an event handler and set its `allowEvent` property to `false`<!-- -->, this property
specifies the ID of the task pane that opens when the **Don't Send** button is selected from the Smart Alerts
dialog.
For an example, see the [Smart Alerts
walkthrough](https://learn.microsoft.com/office/dev/add-ins/outlook/smart-alerts-onmessagesend-walkthrough#customize-the-dont-send-button-optional)<!--
-->.
remarks: >-
\[ [API set: Mailbox 1.14](/javascript/api/requirement-sets/outlook/outlook-api-requirement-sets) \]
**[Minimum permission level
(Outlook)](https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions)<!--
-->**: **restricted**
**[Applicable Outlook
mode](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points)<!--
-->**: Compose
**Important**:
The `commandId` value must match the task pane ID specified in the manifest of your add-in. The markup depends on
the type of manifest your add-in uses.
- **XML manifest**: The `id` attribute of the
[Control](https://learn.microsoft.com/javascript/api/manifest/control) element representing the task pane.
- **Unified manifest for Microsoft 365**: The "id" property of the task pane command in the
"extensions.ribbons.tabs.groups.controls" array.
If you specify the `contextData` option in your `event.completed` call, you must also assign a task pane ID to the
`commandId` option. Otherwise, the JSON data assigned to `contextData` is ignored.
isPreview: false
isDeprecated: false
syntax:
content: 'commandId?: string;'
return:
type: string
- name: contextData
uid: 'outlook!Office.SmartAlertsEventCompletedOptions#contextData:member'
package: outlook!
fullName: contextData
summary: >-
When you use the [completed
method](https://learn.microsoft.com/javascript/api/outlook/office.mailboxevent#outlook-office-mailboxevent-completed-member(1))
to signal completion of an event handler and set its `allowEvent` property to `false`<!-- -->, this property
specifies any JSON data passed to the add-in for processing when the **Don't Send** button is selected from
the Smart Alerts dialog.
remarks: >-
\[ [API set: Mailbox 1.14](/javascript/api/requirement-sets/outlook/outlook-api-requirement-sets) \]
**[Minimum permission level
(Outlook)](https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions)<!--
-->**: **restricted**
**[Applicable Outlook
mode](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points)<!--
-->**: Compose
**Important**:
- In Outlook on Windows, the `any` type is supported starting in Version 2402 (Build 17308.20000). In earlier
versions of Outlook on Windows, only the `string` type is supported.
- If you specify the `contextData` option in your `event.completed` call, you must also assign a task pane ID to
the `commandId` option. Otherwise, the JSON data assigned to `contextData` is ignored.
- To retrieve the value of the `contextData` property, you must call
`Office.context.mailbox.item.getInitializationContextAsync` in the JavaScript implementation of your task pane. If
you create a JSON string using `JSON.stringify()` and assign it to the `contextData` property, you must parse the
string using `JSON.parse()` once you retrieve it.
isPreview: false
isDeprecated: false
syntax:
content: 'contextData?: any;'
return:
type: any
- name: errorMessage
uid: 'outlook!Office.SmartAlertsEventCompletedOptions#errorMessage:member'
package: outlook!
fullName: errorMessage
summary: >-
When you use the [completed
method](https://learn.microsoft.com/javascript/api/outlook/office.mailboxevent#outlook-office-mailboxevent-completed-member(1))
to signal completion of an event handler and set its `allowEvent` property to `false`<!-- -->, this property sets
the error message displayed to the user. For an example, see the [Smart Alerts
walkthrough](https://learn.microsoft.com/office/dev/add-ins/outlook/smart-alerts-onmessagesend-walkthrough)<!--
-->.
remarks: >-
\[ [API set: Mailbox 1.12](/javascript/api/requirement-sets/outlook/outlook-api-requirement-sets) \]
**[Minimum permission level
(Outlook)](https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions)<!--
-->**: **restricted**
**[Applicable Outlook
mode](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points)<!--
-->**: Compose
isPreview: false
isDeprecated: false
syntax:
content: 'errorMessage?: string;'
return:
type: string
- name: errorMessageMarkdown
uid: 'outlook!Office.SmartAlertsEventCompletedOptions#errorMessageMarkdown:member'
package: outlook!
fullName: errorMessageMarkdown
summary: >-
When you use the [completed
method](https://learn.microsoft.com/javascript/api/outlook/office.mailboxevent#outlook-office-mailboxevent-completed-member(1))
to signal completion of an event handler and set its `allowEvent` property to `false`<!-- -->, this property sets
the error message displayed to the user. The error message is formatted using Markdown. For an example, see the
[Smart Alerts
walkthrough](https://learn.microsoft.com/office/dev/add-ins/outlook/smart-alerts-onmessagesend-walkthrough)<!--
-->.
remarks: >-
\[ [API set: Mailbox preview](/javascript/api/requirement-sets/outlook/outlook-api-requirement-sets) \]
**[Minimum permission level
(Outlook)](https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions)<!--
-->**: **restricted**
**[Applicable Outlook
mode](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points)<!--
-->**: Compose
**Important**
- The formatted error message must be 500 characters or less.
- For guidance on supported Markdown elements, see [Limitations to formatting the dialog message using
Markdown](https://learn.microsoft.com/office/dev/add-ins/outlook/onmessagesend-onappointmentsend-events#limitations-to-formatting-the-dialog-message-using-markdown)<!--
-->.
- If you format the dialog message using the `errorMessageMarkdown` property, we recommend you also add a
plaintext version of the message using the `errorMessage` property. This ensures that the message is displayed
properly in Outlook clients that don't support Markdown.
isPreview: true
isDeprecated: false
syntax:
content: 'errorMessageMarkdown?: string;'
return:
type: string
- name: sendModeOverride
uid: 'outlook!Office.SmartAlertsEventCompletedOptions#sendModeOverride:member'
package: outlook!
fullName: sendModeOverride
summary: >-
When you use the [completed
method](https://learn.microsoft.com/javascript/api/outlook/office.mailboxevent#outlook-office-mailboxevent-completed-member(1))
to signal completion of an event handler and set its `allowEvent` property to `false`<!-- -->, this property
overrides the [send mode
option](https://learn.microsoft.com/office/dev/add-ins/outlook/onmessagesend-onappointmentsend-events#available-send-mode-options)
specified in the manifest at runtime.
For an example, see the [Smart Alerts
walkthrough](https://learn.microsoft.com/office/dev/add-ins/outlook/smart-alerts-onmessagesend-walkthrough#override-the-send-mode-option-at-runtime-optional)<!--
-->.
remarks: >-
\[ [API set: Mailbox 1.14](/javascript/api/requirement-sets/outlook/outlook-api-requirement-sets) \]
**[Minimum permission level
(Outlook)](https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions)<!--
-->**: **restricted**
**[Applicable Outlook
mode](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points)<!--
-->**: Compose
**Important**: Currently, `sendModeOverride` can only be set to the [prompt
user](https://learn.microsoft.com/office/dev/add-ins/outlook/onmessagesend-onappointmentsend-events#prompt-user)
option.
isPreview: false
isDeprecated: false
syntax:
content: 'sendModeOverride?: MailboxEnums.SendModeOverride | string;'
return:
type: '<xref uid="outlook!Office.MailboxEnums.SendModeOverride:enum" /> | string'