-
Notifications
You must be signed in to change notification settings - Fork 64
/
office.recipients.yml
716 lines (520 loc) · 27.3 KB
/
office.recipients.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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
### YamlMime:TSType
name: Office.Recipients
uid: 'outlook!Office.Recipients:interface'
package: outlook!
fullName: Office.Recipients
summary: Represents recipients of an item. Compose mode only.
remarks: >-
\[ [API set: Mailbox 1.1](/javascript/api/requirement-sets/outlook/outlook-api-requirement-sets) \]
**[Minimum permission
level](https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions)<!-- -->**:
**read item**
**[Applicable Outlook
mode](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points)<!-- -->**:
Compose
isPreview: false
isDeprecated: false
type: interface
methods:
- name: 'addAsync(recipients, options, callback)'
uid: 'outlook!Office.Recipients#addAsync:member(1)'
package: outlook!
fullName: 'addAsync(recipients, options, callback)'
summary: Adds a recipient list to the existing recipients for an appointment or message.
remarks: >-
\[ [API set: Mailbox 1.1](/javascript/api/requirement-sets/outlook/outlook-api-requirement-sets) \]
**[Minimum permission
level](https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions)<!--
-->**: **read/write item**
**[Applicable Outlook
mode](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points)<!--
-->**: Compose
**Important**: With the `addAsync` method, you can add a maximum of 100 recipients to a mail item in Outlook
on the web, on Windows ([new](https://support.microsoft.com/office/656bb8d9-5a60-49b2-a98b-ba7822bc7627) and
classic), on Mac (classic UI), on Android, and on iOS. However, take note of the following:
- In Outlook on the web, on Windows (new and classic), and on Mac (classic UI), you can have a maximum of 500
recipients in a target field. If you need to add more than 100 recipients to a mail item, you can call `addAsync`
repeatedly, but be mindful of the recipient limit of the field.
- In Outlook on Android and on iOS, the `addAsync` method isn't supported in Message Compose mode. Only the
Appointment Organizer mode is supported. For more information on supported APIs in Outlook mobile, see [Outlook
JavaScript APIs supported in Outlook on mobile
devices](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-mobile-apis)<!-- -->.
There's no recipient limit if you call `addAsync` in Outlook on Mac (new UI).
**Errors**:
- `NumberOfRecipientsExceeded`<!-- -->: The number of recipients exceeded 100 entries.
#### Examples
```TypeScript
// The following example creates an array of EmailUser objects
// and adds them to the To recipients of the message.
const newRecipients = [
{
"displayName": "Allie Bellew",
"emailAddress": "allieb@contoso.com"
},
{
"displayName": "Alex Darrow",
"emailAddress": "alexd@contoso.com"
}
];
Office.context.mailbox.item.to.addAsync(newRecipients, function(result) {
if (result.error) {
console.log(result.error);
} else {
console.log("Recipients added");
}
});
```
isPreview: false
isDeprecated: false
syntax:
content: >-
addAsync(recipients: Array<string | EmailUser | EmailAddressDetails>, options: Office.AsyncContextOptions,
callback?: (asyncResult: Office.AsyncResult<void>) => void): void;
parameters:
- id: recipients
description: >-
The recipients to add to the recipients list. The array of recipients can contain strings of SMTP email
addresses, [EmailUser](xref:outlook!Office.EmailUser:interface) objects, or
[EmailAddressDetails](xref:outlook!Office.EmailAddressDetails:interface) objects.
type: >-
Array<string | <xref uid="outlook!Office.EmailUser:interface" /> | <xref
uid="outlook!Office.EmailAddressDetails:interface" />>
- id: options
description: >-
An object literal that contains one or more of the following properties:- `asyncContext`<!-- -->: Developers
can provide any object they wish to access in the callback function.
type: '<xref uid="office!Office.AsyncContextOptions:interface" />'
- id: callback
description: >-
Optional. When the method completes, the function passed in the `callback` parameter is called with a single
parameter of type `Office.AsyncResult`<!-- -->. If adding the recipients fails, the `asyncResult.error`
property will contain an error code.
type: '(asyncResult: <xref uid="office!Office.AsyncResult:interface" /><void>) => void'
return:
type: void
description: ''
- name: 'addAsync(recipients, callback)'
uid: 'outlook!Office.Recipients#addAsync:member(2)'
package: outlook!
fullName: 'addAsync(recipients, callback)'
summary: Adds a recipient list to the existing recipients for an appointment or message.
remarks: >-
\[ [API set: Mailbox 1.1](/javascript/api/requirement-sets/outlook/outlook-api-requirement-sets) \]
**[Minimum permission
level](https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions)<!--
-->**: **read/write item**
**[Applicable Outlook
mode](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points)<!--
-->**: Compose
**Important**: With the `addAsync` method, you can add a maximum of 100 recipients to a mail item in Outlook
on the web, on Windows ([new](https://support.microsoft.com/office/656bb8d9-5a60-49b2-a98b-ba7822bc7627) and
classic), on Mac (classic UI), on Android, and on iOS. However, take note of the following:
- In Outlook on the web, on Windows (new and classic), and on Mac (classic UI), you can have a maximum of 500
recipients in a target field. If you need to add more than 100 recipients to a mail item, you can call `addAsync`
repeatedly, but be mindful of the recipient limit of the field.
- In Outlook on Android and on iOS, the `addAsync` method isn't supported in Message Compose mode. Only the
Appointment Organizer mode is supported. For more information on supported APIs in Outlook mobile, see [Outlook
JavaScript APIs supported in Outlook on mobile
devices](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-mobile-apis)<!-- -->.
There's no recipient limit if you call `addAsync` in Outlook on Mac (new UI).
**Errors**:
- `NumberOfRecipientsExceeded`<!-- -->: The number of recipients exceeded 100 entries.
isPreview: false
isDeprecated: false
syntax:
content: >-
addAsync(recipients: Array<string | EmailUser | EmailAddressDetails>, callback?: (asyncResult:
Office.AsyncResult<void>) => void): void;
parameters:
- id: recipients
description: >-
The recipients to add to the recipients list. The array of recipients can contain strings of SMTP email
addresses, [EmailUser](xref:outlook!Office.EmailUser:interface) objects, or
[EmailAddressDetails](xref:outlook!Office.EmailAddressDetails:interface) objects.
type: >-
Array<string | <xref uid="outlook!Office.EmailUser:interface" /> | <xref
uid="outlook!Office.EmailAddressDetails:interface" />>
- id: callback
description: >-
Optional. When the method completes, the function passed in the `callback` parameter is called with a single
parameter of type `Office.AsyncResult`<!-- -->. If adding the recipients fails, the `asyncResult.error`
property will contain an error code.
type: '(asyncResult: <xref uid="office!Office.AsyncResult:interface" /><void>) => void'
return:
type: void
description: ''
- name: 'getAsync(options, callback)'
uid: 'outlook!Office.Recipients#getAsync:member(1)'
package: outlook!
fullName: 'getAsync(options, callback)'
summary: Gets a recipient list for an appointment or message.
remarks: >-
\[ [API set: Mailbox 1.1](/javascript/api/requirement-sets/outlook/outlook-api-requirement-sets) \]
**[Minimum permission
level](https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions)<!--
-->**: **read item**
**[Applicable Outlook
mode](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points)<!--
-->**: Compose
**Important**:
The maximum number of recipients returned by this method varies per Outlook client.
- Windows ([new](https://support.microsoft.com/office/656bb8d9-5a60-49b2-a98b-ba7822bc7627) and classic), web
browser, Mac (classic UI): 500 recipients
- Android, iOS: 100 recipients
- Mac (new UI): No limit
The `getAsync` method only returns recipients resolved by the Outlook client. A resolved recipient has the
following characteristics.
- If the recipient has a saved entry in the sender's address book, Outlook resolves the email address to the
recipient's saved display name.
- A Teams meeting status icon appears before the recipient's name or email address.
- A semicolon appears after the recipient's name or email address.
- The recipient's name or email address is underlined or enclosed in a box.
To resolve an email address once it's added to a mail item, the sender must use the **Tab** key or select a
suggested contact or email address from the auto-complete list.
In Outlook on the web and on Windows (new and classic), if a user creates a new message by activating a contact's
email address link from their contact or profile card, your add-in's `Recipients.getAsync` call returns the
contact's email address in the `displayName` property of the associated
[EmailAddressDetails](xref:outlook!Office.EmailAddressDetails:interface) object instead of the contact's saved
name. For more details, see [related GitHub issue](https://github.com/OfficeDev/office-js/issues/2201)<!-- -->.
isPreview: false
isDeprecated: false
syntax:
content: >-
getAsync(options: Office.AsyncContextOptions, callback: (asyncResult:
Office.AsyncResult<EmailAddressDetails[]>) => void): void;
parameters:
- id: options
description: >-
An object literal that contains one or more of the following properties:- `asyncContext`<!-- -->: Developers
can provide any object they wish to access in the callback function.
type: '<xref uid="office!Office.AsyncContextOptions:interface" />'
- id: callback
description: >-
When the method completes, the function passed in the `callback` parameter is called with a single
parameter, `asyncResult`<!-- -->, of type `Office.AsyncResult`<!-- -->. The `asyncResult.value` property of
the result is an array of [EmailAddressDetails](xref:outlook!Office.EmailAddressDetails:interface) objects.
type: >-
(asyncResult: <xref uid="office!Office.AsyncResult:interface" /><<xref
uid="outlook!Office.EmailAddressDetails:interface" />[]>) => void
return:
type: void
description: ''
- name: getAsync(callback)
uid: 'outlook!Office.Recipients#getAsync:member(2)'
package: outlook!
fullName: getAsync(callback)
summary: Gets a recipient list for an appointment or message.
remarks: >-
\[ [API set: Mailbox 1.1](/javascript/api/requirement-sets/outlook/outlook-api-requirement-sets) \]
**[Minimum permission
level](https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions)<!--
-->**: **read item**
**[Applicable Outlook
mode](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points)<!--
-->**: Compose
**Important**:
The maximum number of recipients returned by this method varies per Outlook client.
- Windows ([new](https://support.microsoft.com/office/656bb8d9-5a60-49b2-a98b-ba7822bc7627) and classic), web
browser, Mac (classic UI): 500 recipients
- Android, iOS: 100 recipients
- Mac (new UI): No limit
The `getAsync` method only returns recipients resolved by the Outlook client. A resolved recipient has the
following characteristics.
- If the recipient has a saved entry in the sender's address book, Outlook resolves the email address to the
recipient's saved display name.
- A Teams meeting status icon appears before the recipient's name or email address.
- A semicolon appears after the recipient's name or email address.
- The recipient's name or email address is underlined or enclosed in a box.
To resolve an email address once it's added to a mail item, the sender must use the **Tab** key or select a
suggested contact or email address from the auto-complete list.
In Outlook on the web and on Windows (new and classic), if a user creates a new message by activating a contact's
email address link from their contact or profile card, your add-in's `Recipients.getAsync` call returns the
contact's email address in the `displayName` property of the associated
[EmailAddressDetails](xref:outlook!Office.EmailAddressDetails:interface) object instead of the contact's saved
name. For more details, see [related GitHub issue](https://github.com/OfficeDev/office-js/issues/2201)<!-- -->.
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/30-recipients-and-attendees/get-set-bcc-message-compose.yaml
Office.context.mailbox.item.bcc.getAsync(function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
const msgBcc = asyncResult.value;
console.log("Message being blind-copied to:");
for (let i = 0; i < msgBcc.length; i++) {
console.log(msgBcc[i].displayName + " (" + msgBcc[i].emailAddress + ")");
}
} else {
console.error(asyncResult.error);
}
});
...
Office.context.mailbox.item.cc.getAsync(function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
const msgCc = asyncResult.value;
console.log("Message being copied to:");
for (let i = 0; i < msgCc.length; i++) {
console.log(msgCc[i].displayName + " (" + msgCc[i].emailAddress + ")");
}
} else {
console.error(asyncResult.error);
}
});
...
Office.context.mailbox.item.optionalAttendees.getAsync(function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
const apptOptionalAttendees = asyncResult.value;
for (let i = 0; i < apptOptionalAttendees.length; i++) {
console.log(
"Optional attendees: " +
apptOptionalAttendees[i].displayName +
" (" +
apptOptionalAttendees[i].emailAddress +
") - response: " +
apptOptionalAttendees[i].appointmentResponse
);
}
} else {
console.error(asyncResult.error);
}
});
...
Office.context.mailbox.item.requiredAttendees.getAsync(function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
const apptRequiredAttendees = asyncResult.value;
for (let i = 0; i < apptRequiredAttendees.length; i++) {
console.log(
"Required attendees: " +
apptRequiredAttendees[i].displayName +
" (" +
apptRequiredAttendees[i].emailAddress +
") - response: " +
apptRequiredAttendees[i].appointmentResponse
);
}
} else {
console.error(asyncResult.error);
}
});
...
Office.context.mailbox.item.to.getAsync(function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
const msgTo = asyncResult.value;
console.log("Message being sent to:");
for (let i = 0; i < msgTo.length; i++) {
console.log(msgTo[i].displayName + " (" + msgTo[i].emailAddress + ")");
}
} else {
console.error(asyncResult.error);
}
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'getAsync(callback: (asyncResult: Office.AsyncResult<EmailAddressDetails[]>) => void): void;'
parameters:
- id: callback
description: >-
When the method completes, the function passed in the `callback` parameter is called with a single
parameter, `asyncResult`<!-- -->, of type `Office.AsyncResult`<!-- -->. The `asyncResult.value` property of
the result is an array of [EmailAddressDetails](xref:outlook!Office.EmailAddressDetails:interface) objects.
type: >-
(asyncResult: <xref uid="office!Office.AsyncResult:interface" /><<xref
uid="outlook!Office.EmailAddressDetails:interface" />[]>) => void
return:
type: void
description: ''
- name: 'setAsync(recipients, options, callback)'
uid: 'outlook!Office.Recipients#setAsync:member(1)'
package: outlook!
fullName: 'setAsync(recipients, options, callback)'
summary: |-
Sets a recipient list for an appointment or message.
The `setAsync` method overwrites the current recipient list.
remarks: >-
\[ [API set: Mailbox 1.1](/javascript/api/requirement-sets/outlook/outlook-api-requirement-sets) \]
**[Minimum permission
level](https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions)<!--
-->**: **read/write item**
**[Applicable Outlook
mode](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points)<!--
-->**: Compose
**Important**: With the `setAsync` method, you can set a maximum of 100 recipients in Outlook on the web, on
Windows ([new](https://support.microsoft.com/office/656bb8d9-5a60-49b2-a98b-ba7822bc7627) and classic), on Mac
(classic UI), on Android, and on iOS. However, take note of the following:
- In Outlook on the web, on Windows (new and classic), and on Mac (classic UI), you can have a maximum of 500
recipients in a target field. If you need to set more than 100 recipients, you can call `setAsync` repeatedly, but
be mindful of the recipient limit of the field.
- In Outlook on Android and on iOS, the `setAsync` method isn't supported in the Message Compose mode. Only the
Appointment Organizer mode is supported. For more information on supported APIs in Outlook mobile, see [Outlook
JavaScript APIs supported in Outlook on mobile
devices](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-mobile-apis)<!-- -->.
There's no recipient limit if you call `setAsync` in Outlook on Mac (new UI).
**Errors**:
- `NumberOfRecipientsExceeded`<!-- -->: The number of recipients exceeded 100 entries.
isPreview: false
isDeprecated: false
syntax:
content: >-
setAsync(recipients: Array<string | EmailUser | EmailAddressDetails>, options: Office.AsyncContextOptions,
callback: (asyncResult: Office.AsyncResult<void>) => void): void;
parameters:
- id: recipients
description: >-
The recipients to add to the recipients list. The array of recipients can contain strings of SMTP email
addresses, [EmailUser](xref:outlook!Office.EmailUser:interface) objects, or
[EmailAddressDetails](xref:outlook!Office.EmailAddressDetails:interface) objects.
type: >-
Array<string | <xref uid="outlook!Office.EmailUser:interface" /> | <xref
uid="outlook!Office.EmailAddressDetails:interface" />>
- id: options
description: >-
An object literal that contains one or more of the following properties:- `asyncContext`<!-- -->: Developers
can provide any object they wish to access in the callback function.
type: '<xref uid="office!Office.AsyncContextOptions:interface" />'
- id: callback
description: >-
When the method completes, the function passed in the `callback` parameter is called with a single parameter
of type `Office.AsyncResult`<!-- -->. If setting the recipients fails the `asyncResult.error` property will
contain a code that indicates any error that occurred while adding the data.
type: '(asyncResult: <xref uid="office!Office.AsyncResult:interface" /><void>) => void'
return:
type: void
description: ''
- name: 'setAsync(recipients, callback)'
uid: 'outlook!Office.Recipients#setAsync:member(2)'
package: outlook!
fullName: 'setAsync(recipients, callback)'
summary: |-
Sets a recipient list for an appointment or message.
The `setAsync` method overwrites the current recipient list.
remarks: >-
\[ [API set: Mailbox 1.1](/javascript/api/requirement-sets/outlook/outlook-api-requirement-sets) \]
**[Minimum permission
level](https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions)<!--
-->**: **read/write item**
**[Applicable Outlook
mode](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points)<!--
-->**: Compose
**Important**: With the `setAsync` method, you can set a maximum of 100 recipients in Outlook on the web, on
Windows ([new](https://support.microsoft.com/office/656bb8d9-5a60-49b2-a98b-ba7822bc7627) and classic), on Mac
(classic UI), on Android, and on iOS. However, take note of the following:
- In Outlook on the web, on Windows (new and classic), and on Mac (classic UI), you can have a maximum of 500
recipients in a target field. If you need to set more than 100 recipients, you can call `setAsync` repeatedly, but
be mindful of the recipient limit of the field.
- In Outlook on Android and on iOS, the `setAsync` method isn't supported in the Message Compose mode. Only the
Appointment Organizer mode is supported. For more information on supported APIs in Outlook mobile, see [Outlook
JavaScript APIs supported in Outlook on mobile
devices](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-mobile-apis)<!-- -->.
There's no recipient limit if you call `setAsync` in Outlook on Mac (new UI).
**Errors**:
- `NumberOfRecipientsExceeded`<!-- -->: The number of recipients exceeded 100 entries.
#### Examples
```TypeScript
// The following example creates an array of EmailUser objects and
// replaces the CC recipients of the message with the array.
const newRecipients = [
{
"displayName": "Allie Bellew",
"emailAddress": "allieb@contoso.com"
},
{
"displayName": "Alex Darrow",
"emailAddress": "alexd@contoso.com"
}
];
Office.context.mailbox.item.cc.setAsync(newRecipients, function(result) {
if (result.error) {
console.log(result.error);
} else {
console.log("Recipients overwritten");
}
});
```
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/30-recipients-and-attendees/get-set-bcc-message-compose.yaml
const email = $("#emailBcc")
.val()
.toString();
const emailArray = [email];
Office.context.mailbox.item.bcc.setAsync(emailArray, function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
console.log("Succeeded in setting Bcc field.");
} else {
console.error(asyncResult.error);
}
});
...
const email = $("#emailCc")
.val()
.toString();
const emailArray = [email];
Office.context.mailbox.item.cc.setAsync(emailArray, function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
console.log("Succeeded in setting Cc field.");
} else {
console.error(asyncResult.error);
}
});
...
const email = $("#emailOptional")
.val()
.toString();
const emailArray = [email];
Office.context.mailbox.item.optionalAttendees.setAsync(emailArray, function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
console.log("Succeeded in setting optional attendees field.");
} else {
console.error(asyncResult.error);
}
});
...
const email = $("#emailRequired")
.val()
.toString();
const emailArray = [email];
Office.context.mailbox.item.requiredAttendees.setAsync(emailArray, function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
console.log("Succeeded in setting required attendees field.");
} else {
console.error(asyncResult.error);
}
});
...
const email = $("#emailTo")
.val()
.toString();
const emailArray = [email];
Office.context.mailbox.item.to.setAsync(emailArray, function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
console.log("Succeeded in setting To field.");
} else {
console.error(asyncResult.error);
}
});
```
isPreview: false
isDeprecated: false
syntax:
content: >-
setAsync(recipients: Array<string | EmailUser | EmailAddressDetails>, callback: (asyncResult:
Office.AsyncResult<void>) => void): void;
parameters:
- id: recipients
description: >-
The recipients to add to the recipients list. The array of recipients can contain strings of SMTP email
addresses, [EmailUser](xref:outlook!Office.EmailUser:interface) objects, or
[EmailAddressDetails](xref:outlook!Office.EmailAddressDetails:interface) objects.
type: >-
Array<string | <xref uid="outlook!Office.EmailUser:interface" /> | <xref
uid="outlook!Office.EmailAddressDetails:interface" />>
- id: callback
description: >-
When the method completes, the function passed in the `callback` parameter is called with a single parameter
of type `Office.AsyncResult`<!-- -->. If setting the recipients fails the `asyncResult.error` property will
contain a code that indicates any error that occurred while adding the data.
type: '(asyncResult: <xref uid="office!Office.AsyncResult:interface" /><void>) => void'
return:
type: void
description: ''