-
Notifications
You must be signed in to change notification settings - Fork 61
/
office.messagecompose.yml
3505 lines (2606 loc) · 140 KB
/
office.messagecompose.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
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
### YamlMime:TSType
name: Office.MessageCompose
uid: 'outlook!Office.MessageCompose:interface'
package: outlook!
fullName: Office.MessageCompose
summary: >-
The message compose mode of [Office.context.mailbox.item](xref:outlook!Office.Item:interface)<!-- -->.
**Important**: This is an internal Outlook object, not directly exposed through existing interfaces. You should
treat this as a mode of `Office.context.mailbox.item`<!-- -->. For more information, refer to the [Object
Model](https://learn.microsoft.com/javascript/api/requirement-sets/outlook/requirement-set-1.12/office.context.mailbox.item)
page.
Parent interfaces:
- [ItemCompose](xref:outlook!Office.ItemCompose:interface)
- [Message](xref:outlook!Office.Message:interface)
remarks: ''
isPreview: false
isDeprecated: false
type: interface
properties:
- name: bcc
uid: 'outlook!Office.MessageCompose#bcc:member'
package: outlook!
fullName: bcc
summary: >-
Gets an object that provides methods to get or update the recipients on the **Bcc** (blind carbon copy) line
of a message.
Depending on the client/platform (i.e., Windows, Mac, etc.), limits may apply on how many recipients you can get
or update. See the [Recipients](xref:outlook!Office.Recipients:interface) object for more details.
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)<!--
-->**: Message Compose
#### Examples
```TypeScript
Office.context.mailbox.item.bcc.setAsync( ['alice@contoso.com', 'bob@contoso.com'] );
Office.context.mailbox.item.bcc.addAsync( ['jason@contoso.com'] );
Office.context.mailbox.item.bcc.getAsync(callback);
function callback(asyncResult) {
const arrayOfBccRecipients = asyncResult.value;
}
```
```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);
}
});
...
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);
}
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'bcc: Recipients;'
return:
type: '<xref uid="outlook!Office.Recipients:interface" />'
- name: body
uid: 'outlook!Office.MessageCompose#body:member'
package: outlook!
fullName: body
summary: Gets an object that provides methods for manipulating the body of an item.
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)<!--
-->**: Message Compose
#### Examples
```TypeScript
// This example gets the body of the item as plain text.
Office.context.mailbox.item.body.getAsync(
"text",
{ asyncContext: "This is passed to the callback" },
function callback(result) {
// Do something with the result.
});
// The following is an example of the result parameter passed to the callback function.
{
"value": "TEXT of whole body (including threads below)",
"status": "succeeded",
"asyncContext": "This is passed to the callback"
}
```
isPreview: false
isDeprecated: false
syntax:
content: 'body: Body;'
return:
type: '<xref uid="outlook!Office.Body:interface" />'
- name: categories
uid: 'outlook!Office.MessageCompose#categories:member'
package: outlook!
fullName: categories
summary: |-
Gets an object that provides methods for managing the item's categories.
**Important**: In Outlook on the web, you can't use the API to manage categories on a message in Compose mode.
remarks: >-
\[ [API set: Mailbox 1.8](/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)<!--
-->**: Message Compose
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/45-categories/work-with-categories.yaml
Office.context.mailbox.item.categories.getAsync(function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
const categories = asyncResult.value;
if (categories && categories.length > 0) {
console.log("Categories assigned to this item:");
console.log(JSON.stringify(categories));
} else {
console.log("There are no categories assigned to this item.");
}
} else {
console.error(asyncResult.error);
}
});
...
// Note: In order for you to successfully add a category,
// it must be in the mailbox categories master list.
Office.context.mailbox.masterCategories.getAsync(function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
const masterCategories = asyncResult.value;
if (masterCategories && masterCategories.length > 0) {
// Grab the first category from the master list.
const categoryToAdd = [masterCategories[0].displayName];
Office.context.mailbox.item.categories.addAsync(categoryToAdd, function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
console.log(`Successfully assigned category '${categoryToAdd}' to item.`);
} else {
console.log("categories.addAsync call failed with error: " + asyncResult.error.message);
}
});
} else {
console.log("There are no categories in the master list on this mailbox. You can add categories using Office.context.mailbox.masterCategories.addAsync.");
}
} else {
console.error(asyncResult.error);
}
});
...
Office.context.mailbox.item.categories.getAsync(function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
const categories = asyncResult.value;
if (categories && categories.length > 0) {
// Grab the first category assigned to this item.
const categoryToRemove = [categories[0].displayName];
Office.context.mailbox.item.categories.removeAsync(categoryToRemove, function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
console.log(`Successfully unassigned category '${categoryToRemove}' from this item.`);
} else {
console.log("categories.removeAsync call failed with error: " + asyncResult.error.message);
}
});
} else {
console.log("There are no categories assigned to this item.");
}
} else {
console.error(asyncResult.error);
}
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'categories: Categories;'
return:
type: '<xref uid="outlook!Office.Categories:interface" />'
- name: cc
uid: 'outlook!Office.MessageCompose#cc:member'
package: outlook!
fullName: cc
summary: >-
Provides access to the Cc (carbon copy) recipients of a message. The type of object and level of access depend on
the mode of the current item.
The `cc` property returns a `Recipients` object that provides methods to get or update the recipients on the
**Cc** line of the message. However, depending on the client/platform (i.e., Windows, Mac, etc.), limits may
apply on how many recipients you can get or update. See the [Recipients](xref:outlook!Office.Recipients:interface)
object for more details.
remarks: >-
**[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)<!--
-->**: Message Compose
#### Examples
```TypeScript
Office.context.mailbox.item.cc.setAsync( ['alice@contoso.com', 'bob@contoso.com'] );
Office.context.mailbox.item.cc.addAsync( ['jason@contoso.com'] );
Office.context.mailbox.item.cc.getAsync(callback);
function callback(asyncResult) {
const arrayOfCcRecipients = asyncResult.value;
}
```
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/30-recipients-and-attendees/get-set-cc-message-compose.yaml
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);
}
});
...
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);
}
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'cc: Recipients;'
return:
type: '<xref uid="outlook!Office.Recipients:interface" />'
- name: conversationId
uid: 'outlook!Office.MessageCompose#conversationId:member'
package: outlook!
fullName: conversationId
summary: >-
Gets an identifier for the email conversation that contains a particular message.
You can get an integer for this property if your mail app is activated in read forms or responses in compose
forms. If subsequently the user changes the subject of the reply message, upon sending the reply, the conversation
ID for that message will change and that value you obtained earlier will no longer apply.
You get null for this property for a new item in a compose form. If the user sets a subject and saves the item,
the `conversationId` property will return a value.
remarks: >-
**[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)<!--
-->**: Message Compose
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-conversation-id-message.yaml
console.log(`Conversation ID: ${Office.context.mailbox.item.conversationId}`);
```
isPreview: false
isDeprecated: false
syntax:
content: 'conversationId: string;'
return:
type: string
- name: from
uid: 'outlook!Office.MessageCompose#from:member'
package: outlook!
fullName: from
summary: |-
Gets the email address of the sender of a message.
The `from` property returns a `From` object that provides a method to get the from value.
remarks: >-
\[ [API set: Mailbox 1.7](/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)<!--
-->**: Message Compose
**Important**: This property is supported in Outlook on Android and on iOS. For a sample scenario, see
[Implement event-based activation in Outlook mobile
add-ins](https://learn.microsoft.com/office/dev/add-ins/outlook/mobile-event-based)<!-- -->.
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/30-recipients-and-attendees/get-from-message-compose.yaml
Office.context.mailbox.item.from.getAsync(function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
const msgFrom = asyncResult.value;
console.log("Message from: " + msgFrom.displayName + " (" + msgFrom.emailAddress + ")");
} else {
console.error(asyncResult.error);
}
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'from: From;'
return:
type: '<xref uid="outlook!Office.From:interface" />'
- name: internetHeaders
uid: 'outlook!Office.MessageCompose#internetHeaders:member'
package: outlook!
fullName: internetHeaders
summary: >-
Gets or sets the custom internet headers of a message.
The `internetHeaders` property returns an `InternetHeaders` object that provides methods to manage the internet
headers on the message.
To learn more, see [Get and set internet headers on a message in an Outlook
add-in](https://learn.microsoft.com/office/dev/add-ins/outlook/internet-headers)<!-- -->.
remarks: >-
\[ [API set: Mailbox 1.8](/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)<!--
-->**: Message Compose
**Important**: The internet headers API is supported in Outlook on Android and on iOS starting in Version
4.2405.0. To learn more about features supported in Outlook on mobile devices, see [Outlook JavaScript APIs
supported in Outlook on mobile
devices](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-mobile-apis)<!-- -->.
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/70-mime-headers/manage-custom-internet-headers-message-compose.yaml
Office.context.mailbox.item.internetHeaders.getAsync(
["preferred-fruit", "preferred-vegetable", "best-vegetable", "nonexistent-header"],
function (asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
console.log("Selected headers: " + JSON.stringify(asyncResult.value));
} else {
console.log("Error getting selected headers: " + JSON.stringify(asyncResult.error));
}
}
);
```
isPreview: false
isDeprecated: false
syntax:
content: 'internetHeaders: InternetHeaders;'
return:
type: '<xref uid="outlook!Office.InternetHeaders:interface" />'
- name: itemType
uid: 'outlook!Office.MessageCompose#itemType:member'
package: outlook!
fullName: itemType
summary: >-
Gets the type of item that an instance represents.
The `itemType` property returns one of the `ItemType` enumeration values, indicating whether the item object
instance is a message or an appointment.
remarks: >-
**[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)<!--
-->**: Message Compose
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-item-type.yaml
const itemType = Office.context.mailbox.item.itemType;
switch (itemType) {
case Office.MailboxEnums.ItemType.Appointment:
console.log(`Current item is an ${itemType}.`);
break;
case Office.MailboxEnums.ItemType.Message:
console.log(`Current item is a ${itemType}. A message could be an email, meeting request, meeting response, or meeting cancellation.`);
break;
}
```
isPreview: false
isDeprecated: false
syntax:
content: 'itemType: MailboxEnums.ItemType | string;'
return:
type: '<xref uid="outlook!Office.MailboxEnums.ItemType:enum" /> | string'
- name: notificationMessages
uid: 'outlook!Office.MessageCompose#notificationMessages:member'
package: outlook!
fullName: notificationMessages
summary: Gets the notification messages for an item.
remarks: >-
\[ [API set: Mailbox 1.3](/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)<!--
-->**: Message Compose
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/35-notifications/add-getall-remove.yaml
// Adds a progress indicator to the mail item.
const id = $("#notificationId").val().toString();
const details =
{
type: Office.MailboxEnums.ItemNotificationMessageType.ProgressIndicator,
message: "Progress indicator with id = " + id
};
Office.context.mailbox.item.notificationMessages.addAsync(id, details, handleResult);
...
// Adds an informational notification to the mail item.
const id = $("#notificationId").val().toString();
const details =
{
type: Office.MailboxEnums.ItemNotificationMessageType.InformationalMessage,
message: "Non-persistent informational notification message with id = " + id,
icon: "icon1",
persistent: false
};
Office.context.mailbox.item.notificationMessages.addAsync(id, details, handleResult);
...
// Adds a persistent information notification to the mail item.
const id = $("#notificationId").val().toString();
const details =
{
type: Office.MailboxEnums.ItemNotificationMessageType.InformationalMessage,
message: "Persistent informational notification message with id = " + id,
icon: "icon1",
persistent: true
};
Office.context.mailbox.item.notificationMessages.addAsync(id, details, handleResult);
...
// Gets all the notification messages and their keys for the current mail item.
Office.context.mailbox.item.notificationMessages.getAllAsync((asyncResult) => {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
console.log(asyncResult.error.message);
return;
}
console.log(asyncResult.value);
});
...
// Replaces a notification message of a given key with another message.
const id = $("#notificationId").val().toString();
Office.context.mailbox.item.notificationMessages.replaceAsync(
id,
{
type: Office.MailboxEnums.ItemNotificationMessageType.InformationalMessage,
message: "Notification message with id = " + id + " has been replaced with an informational message.",
icon: "icon2",
persistent: false
},
handleResult);
...
// Removes a notification message from the current mail item.
const id = $("#notificationId").val().toString();
Office.context.mailbox.item.notificationMessages.removeAsync(id, handleResult);
```
isPreview: false
isDeprecated: false
syntax:
content: 'notificationMessages: NotificationMessages;'
return:
type: '<xref uid="outlook!Office.NotificationMessages:interface" />'
- name: seriesId
uid: 'outlook!Office.MessageCompose#seriesId:member'
package: outlook!
fullName: seriesId
summary: >-
Gets the ID of the series that an instance belongs to.
In Outlook on the web and on desktop clients, the `seriesId` returns the Exchange Web Services (EWS) ID of the
parent (series) item that this item belongs to. However, on iOS and Android, the seriesId returns the REST ID of
the parent item.
**Note**: The identifier returned by the `seriesId` property is the same as the Exchange Web Services item
identifier. The `seriesId` property is not identical to the Outlook IDs used by the Outlook REST API. Before
making REST API calls using this value, it should be converted using `Office.context.mailbox.convertToRestId`<!--
-->. For more details, see [Use the Outlook REST APIs from an Outlook
add-in](https://learn.microsoft.com/office/dev/add-ins/outlook/use-rest-api)<!-- -->.
The `seriesId` property returns `null` for items that do not have parent items such as single appointments, series
items, or meeting requests and returns `undefined` for any other items that are not meeting requests.
remarks: >-
\[ [API set: Mailbox 1.7](/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)<!--
-->**: Message Compose
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/50-recurrence/get-series-id.yaml
const seriesId = Office.context.mailbox.item.seriesId;
if (seriesId === undefined) {
console.log("This is a message that's not a meeting request.");
} else if (seriesId === null) {
console.log("This is a single appointment, a parent series, or a meeting request for a series or single meeting.");
} else {
console.log("This is an instance belonging to series with ID " + seriesId);
}
```
isPreview: false
isDeprecated: false
syntax:
content: 'seriesId: string;'
return:
type: string
- name: sessionData
uid: 'outlook!Office.MessageCompose#sessionData:member'
package: outlook!
fullName: sessionData
summary: |-
Manages the [SessionData](xref:outlook!Office.SessionData:interface) of an item in Compose mode.
**Important**: The entire SessionData object is limited to 50,000 characters per add-in.
remarks: >-
\[ [API set: Mailbox 1.11](/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)<!--
-->**: Message Compose
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/session-data-apis.yaml
Office.context.mailbox.item.sessionData.getAllAsync(function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
console.log("The sessionData is " + JSON.stringify(asyncResult.value));
} else {
console.log("Failed to get all sessionData. Error: " + JSON.stringify(asyncResult.error));
}
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'sessionData: SessionData;'
return:
type: '<xref uid="outlook!Office.SessionData:interface" />'
- name: subject
uid: 'outlook!Office.MessageCompose#subject:member'
package: outlook!
fullName: subject
summary: |-
Gets or sets the description that appears in the subject field of an item.
The `subject` property gets or sets the entire subject of the item, as sent by the email server.
The `subject` property returns a `Subject` object that provides methods to get and set the subject.
remarks: >-
**[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)<!--
-->**: Message Compose
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-set-subject-compose.yaml
Office.context.mailbox.item.subject.getAsync((result) => {
if (result.status !== Office.AsyncResultStatus.Succeeded) {
console.error(`Action failed with message ${result.error.message}`);
return;
}
console.log(`Subject: ${result.value}`);
});
...
let subject = "Hello World!";
Office.context.mailbox.item.subject.setAsync(subject, (result) => {
if (result.status !== Office.AsyncResultStatus.Succeeded) {
console.error(`Action failed with message ${result.error.message}`);
return;
}
console.log(`Successfully set subject to ${subject}`);
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'subject: Subject;'
return:
type: '<xref uid="outlook!Office.Subject:interface" />'
- name: to
uid: 'outlook!Office.MessageCompose#to:member'
package: outlook!
fullName: to
summary: >-
Provides access to the recipients on the **To** line of a message. The type of object and level of access
depend on the mode of the current item.
The `to` property returns a `Recipients` object that provides methods to get or update the recipients on the
**To** line of the message. However, depending on the client/platform (i.e., Windows, Mac, etc.), limits may
apply on how many recipients you can get or update. See the [Recipients](xref:outlook!Office.Recipients:interface)
object for more details.
remarks: >-
**[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)<!--
-->**: Message Compose
#### Examples
```TypeScript
Office.context.mailbox.item.to.setAsync( ['alice@contoso.com', 'bob@contoso.com'] );
Office.context.mailbox.item.to.addAsync( ['jason@contoso.com'] );
Office.context.mailbox.item.to.getAsync(callback);
function callback(asyncResult) {
const arrayOfToRecipients = asyncResult.value;
}
```
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/30-recipients-and-attendees/get-set-to-message-compose.yaml
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);
}
});
...
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: 'to: Recipients;'
return:
type: '<xref uid="outlook!Office.Recipients:interface" />'
methods:
- name: 'addFileAttachmentAsync(uri, attachmentName, options, callback)'
uid: 'outlook!Office.MessageCompose#addFileAttachmentAsync:member(1)'
package: outlook!
fullName: 'addFileAttachmentAsync(uri, attachmentName, options, callback)'
summary: >-
Adds a file to a message or appointment as an attachment.
The `addFileAttachmentAsync` method uploads the file at the specified URI and attaches it to the item in the
compose form.
You can subsequently use the identifier with the `removeAttachmentAsync` method to remove the attachment in the
same session.
**Important**: In recent builds of Outlook on Windows, a bug was introduced that incorrectly appends an
`Authorization: Bearer` header to this action (whether using this API or the Outlook UI). To work around this
issue, you can try using the `addFileAttachmentFromBase64` API introduced with requirement set 1.8.
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)<!--
-->**: Message Compose
**Errors**:
- `AttachmentSizeExceeded`<!-- -->: The attachment is larger than allowed.
- `FileTypeNotSupported`<!-- -->: The attachment has an extension that is not allowed.
- `NumberOfAttachmentsExceeded`<!-- -->: The message or appointment has too many attachments.
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/40-attachments/attachments-compose.yaml
const attachmentUrl = $("#attachmentUrl")
.val()
.toString();
Office.context.mailbox.item.addFileAttachmentAsync(
attachmentUrl,
getFileName(attachmentUrl),
{ isInline: false },
(result) => {
console.log(result);
}
);
```
isPreview: false
isDeprecated: false