|
8757 | 8757 |
|
8758 | 8758 |
|
8759 | 8759 | // Gets the attachments of the current message or appointment in compose
|
8760 |
| - mode. |
| 8760 | + mode. The getAttachmentsAsync call can only be used in compose mode. |
8761 | 8761 |
|
8762 |
| - const options = { asyncContext: { currentItem: item } }; |
8763 |
| - |
8764 |
| - // The getAttachmentsAsync call can only be used in compose mode. |
8765 |
| - |
8766 |
| - item.getAttachmentsAsync(options, callback); |
8767 |
| - |
8768 |
| - |
8769 |
| - function callback(result) { |
| 8762 | + Office.context.mailbox.item.getAttachmentsAsync((result) => { |
8770 | 8763 | if (result.status === Office.AsyncResultStatus.Failed) {
|
8771 | 8764 | console.log(result.error.message);
|
8772 | 8765 | return;
|
|
8779 | 8772 |
|
8780 | 8773 | for (let i = 0; i < result.value.length; i++) {
|
8781 | 8774 | // Log the attachment type and its contents to the console.
|
8782 |
| - result.asyncContext.currentItem.getAttachmentContentAsync(result.value[i].id, handleAttachmentsCallback); |
| 8775 | + Office.context.mailbox.item.getAttachmentContentAsync(result.value[i].id, handleAttachmentsCallback); |
8783 | 8776 | }
|
8784 |
| - } |
| 8777 | + }); |
8785 | 8778 | 'Office.AppointmentCompose#getAttachmentsAsync:member(1)':
|
8786 | 8779 | - >-
|
8787 | 8780 | // Link to full sample:
|
|
9812 | 9805 |
|
9813 | 9806 |
|
9814 | 9807 | // Gets the attachments of the current message or appointment in read mode.
|
| 9808 | + The item.attachments call can only be used in read mode. |
9815 | 9809 |
|
9816 |
| - // The item.attachments call can only be used in read mode. |
| 9810 | + const item = Office.context.mailbox.item; |
9817 | 9811 |
|
9818 | 9812 | const attachments = item.attachments;
|
9819 | 9813 |
|
|
12515 | 12509 |
|
12516 | 12510 |
|
12517 | 12511 | // Gets the attachments of the current message or appointment in compose
|
12518 |
| - mode. |
| 12512 | + mode. The getAttachmentsAsync call can only be used in compose mode. |
12519 | 12513 |
|
12520 |
| - const options = { asyncContext: { currentItem: item } }; |
12521 |
| - |
12522 |
| - // The getAttachmentsAsync call can only be used in compose mode. |
12523 |
| - |
12524 |
| - item.getAttachmentsAsync(options, callback); |
12525 |
| - |
12526 |
| - |
12527 |
| - function callback(result) { |
| 12514 | + Office.context.mailbox.item.getAttachmentsAsync((result) => { |
12528 | 12515 | if (result.status === Office.AsyncResultStatus.Failed) {
|
12529 | 12516 | console.log(result.error.message);
|
12530 | 12517 | return;
|
|
12537 | 12524 |
|
12538 | 12525 | for (let i = 0; i < result.value.length; i++) {
|
12539 | 12526 | // Log the attachment type and its contents to the console.
|
12540 |
| - result.asyncContext.currentItem.getAttachmentContentAsync(result.value[i].id, handleAttachmentsCallback); |
| 12527 | + Office.context.mailbox.item.getAttachmentContentAsync(result.value[i].id, handleAttachmentsCallback); |
12541 | 12528 | }
|
12542 |
| - } |
| 12529 | + }); |
12543 | 12530 | 'Office.MessageCompose#getAttachmentsAsync:member(1)':
|
12544 | 12531 | - >-
|
12545 | 12532 | // Link to full sample:
|
|
13506 | 13493 |
|
13507 | 13494 |
|
13508 | 13495 | // Gets the attachments of the current message or appointment in read mode.
|
| 13496 | + The item.attachments call can only be used in read mode. |
13509 | 13497 |
|
13510 |
| - // The item.attachments call can only be used in read mode. |
| 13498 | + const item = Office.context.mailbox.item; |
13511 | 13499 |
|
13512 | 13500 | const attachments = item.attachments;
|
13513 | 13501 |
|
|
0 commit comments