Office.context.mailbox.item
item
is used to access the currently selected message, meeting request, or appointment. You can determine the type of the item by using the itemType
property.
Requirements
Requirement | Value |
---|---|
Minimum mailbox requirement set version | 1.1 |
Minimum permission level | restricted |
Applicable Outlook mode | Appointment Organizer, Appointment Attendee, Message Compose, or Message Read |
Important
Android and iOS: There are limitations on when add-ins activate and which APIs are available. To learn more, refer to Add mobile support to an Outlook add-in.
Properties
Methods
Method | Minimum permission level |
Details by mode | Minimum requirement set |
---|---|---|---|
addFileAttachmentAsync(uri, attachmentName, [options], [callback]) | read/write item | Appointment Organizer | 1.1 (classic Windows, Mac) 1.8 (Web, new Windows) |
Message Compose | 1.1 (classic Windows, Mac) 1.8 (Web, new Windows) |
||
addFileAttachmentFromBase64Async(base64File, attachmentName, [options], [callback]) | read/write item | Appointment Organizer | 1.8 |
Message Compose | 1.8 | ||
addHandlerAsync(eventType, handler, [options], [callback]) | read item | Appointment Organizer | 1.7 |
Appointment Attendee | 1.7 | ||
Message Compose | 1.7 | ||
Message Read | 1.7 | ||
addItemAttachmentAsync(itemId, attachmentName, [options], [callback]) | read/write item | Appointment Organizer | 1.1 |
Message Compose | 1.1 | ||
close() | restricted | Appointment Organizer | 1.3 |
Message Compose | 1.3 | ||
closeAsync([options], [callback]) | read/write item | Message Compose | 1.14 |
disableClientSignatureAsync([options], [callback]) | read/write item | Appointment Organizer | 1.10 |
Message Compose | 1.10 | ||
displayReplyAllForm(formData) | read item | Appointment Attendee | 1.1 |
Message Read | 1.1 | ||
displayReplyAllFormAsync(formData, [options], [callback]) | read item | Appointment Attendee | 1.9 |
Message Read | 1.9 | ||
displayReplyForm(formData) | read item | Appointment Attendee | 1.1 |
Message Read | 1.1 | ||
displayReplyFormAsync(formData, [options], [callback]) | read item | Appointment Attendee | 1.9 |
Message Read | 1.9 | ||
getAllInternetHeadersAsync([options], [callback]) | read item | Message Read | 1.8 |
getAsFileAsync([options], callback) | read item | Message Read | 1.14 |
getAttachmentContentAsync(attachmentId, [options], [callback]) | read item | Appointment Organizer | 1.8 |
Appointment Attendee | 1.8 | ||
Message Compose | 1.8 | ||
Message Read | 1.8 | ||
getAttachmentsAsync([options], [callback]) | read item | Appointment Organizer | 1.8 |
Message Compose | 1.8 | ||
getComposeTypeAsync([options], callback) | read item | Message Compose | 1.10 |
getConversationIndexAsync([options], callback) | read item | Message Compose | 1.14 |
getEntities() (deprecated) | read item | Appointment Attendee | 1.1 |
Message Read | 1.1 | ||
getEntitiesByType(entityType) (deprecated) | restricted | Appointment Attendee | 1.1 |
Message Read | 1.1 | ||
getFilteredEntitiesByName(name) (deprecated) | read item | Appointment Attendee | 1.1 |
Message Read | 1.1 | ||
getInitializationContextAsync([options], [callback]) | read item | Appointment Organizer | 1.8 |
Appointment Attendee | 1.8 | ||
Message Compose | 1.8 | ||
Message Read | 1.8 | ||
getItemClassAsync([options], callback) | read item | Message Compose | 1.14 |
getItemIdAsync([options], callback) | read item | Appointment Organizer | 1.8 |
Message Compose | 1.8 | ||
getRegExMatches() | read item | Appointment Attendee | 1.1 |
Message Read | 1.1 | ||
getRegExMatchesByName(name) | read item | Appointment Attendee | 1.1 |
Message Read | 1.1 | ||
getSelectedDataAsync(coercionType, [options], callback) | read item | Appointment Organizer | 1.2 |
Message Compose | 1.2 | ||
getSelectedEntities() (deprecated) | read item | Appointment Attendee | 1.6 |
Message Read | 1.6 | ||
getSelectedRegExMatches() | read item | Appointment Attendee | 1.6 |
Message Read | 1.6 | ||
getSharedPropertiesAsync([options], callback) | read item | Appointment Organizer | 1.8 (shared folder support) 1.13 (shared mailbox support) |
Appointment Attendee | 1.8 (shared folder support) 1.13 (shared mailbox support) |
||
Message Compose | 1.8 (shared folder support) 1.13 (shared mailbox support) |
||
Message Read | 1.8 (shared folder support) 1.13 (shared mailbox support) |
||
isClientSignatureEnabledAsync([options], callback) | read item | Appointment Organizer | 1.10 |
Message Compose | 1.10 | ||
loadCustomPropertiesAsync(callback, [userContext]) | read item | Appointment Organizer | 1.1 |
Appointment Attendee | 1.1 | ||
Message Compose | 1.1 | ||
Message Read | 1.1 | ||
removeAttachmentAsync(attachmentId, [options], [callback]) | read/write item | Appointment Organizer | 1.1 |
Message Compose | 1.1 | ||
removeHandlerAsync(eventType, [options], [callback]) | read item | Appointment Organizer | 1.7 |
Appointment Attendee | 1.7 | ||
Message Compose | 1.7 | ||
Message Read | 1.7 | ||
saveAsync([options], callback) | read/write item | Appointment Organizer | 1.3 |
Message Compose | 1.3 | ||
setSelectedDataAsync(data, [options], callback) | read/write item | Appointment Organizer | 1.2 |
Message Compose | 1.2 |
Events
You can subscribe to and unsubscribe from the following events using addHandlerAsync
and removeHandlerAsync
respectively.
Event | Description | Minimum requirement set |
---|---|---|
AppointmentTimeChanged |
The date or time of the selected appointment or series has changed. Only available with task pane implementation. | 1.7 |
AttachmentsChanged |
An attachment has been added to or removed from the item. Only available with task pane implementation. | 1.8 |
EnhancedLocationsChanged |
The location of the selected appointment has changed. Only available with task pane implementation. | 1.8 |
InfobarClicked |
An action has been selected from a notification message. Only available with task pane implementation. | 1.10 |
RecipientsChanged |
The recipient list of the selected item or appointment location has changed. Only available with task pane implementation. | 1.7 |
RecurrenceChanged |
The recurrence pattern of the selected series has changed. Only available with task pane implementation. | 1.7 |
SensitivityLabelChanged |
The sensitivity label of a message or appointment in compose mode has changed. Only available with task pane implementation. | 1.13 |
SpamReporting |
An unsolicited message has been reported in Outlook. Only available with a function command. | 1.14 |
Example
The following JavaScript code example shows how to access the subject
property of the current item in Outlook.
// The initialize function is required for all apps.
Office.onReady(() => {
// Checks for the DOM to load using the jQuery ready function.
$(document).ready(function () {
// After the DOM is loaded, app-specific code can run.
const item = Office.context.mailbox.item;
const subject = item.subject;
// Continue with processing the subject of the current item,
// which can be a message or appointment.
});
});