Item object (JavaScript API for Office)

apps for Office

Provides a base object for all items provided by an application.

Last modified: July 06, 2015

Note Note

The name "apps for Office" is changing to "Office Add-ins". During the transition, the documentation and the UI of some Office host applications and Visual Studio tools might still use the term "apps for Office". For details, see New name for apps for Office and SharePoint.

Hosts:Outlook

App type: Mail

Available in requirement sets

Mailbox

Last changed in Mailbox

1.2

Applicable Outlook modes

Compose or read

See all support details

Office.context.mailbox.item

Methods

Method name

Outlook mode

Description

Introduced in

loadCustomPropertiesAsync

getSelectedDataAsync

setSelectedDataAsync

Compose or read

Compose or read

Componse or read

Loads custom properties that have been stored on the server for a specified item.

Asynchronously returns selected data from the subject or body of a message.

Asynchronously inserts data into the body or subject of a message.

Version 1.0

Version 1.2

Version 1.2

Properties

Property name

Outlook mode

Description

Introduced in

dateTimeCreated

Read

Gets the date and time that the item was created.

Version 1.0

dateTimeModified

Read

Gets the date and time that the item was last modified.

Version 1.0

itemClass

Read

Gets the item class of the item.

Version 1.0

itemId

Read

Gets the unique identifier for the item.

Version 1.0

itemType

Compose or read

Gets the type of the item.

Version 1.0

The Item object is the base object for objects that represent the specified item. You can determine the actual Item instance returned by using the itemType property. The descendent of the Item object associated with the item type is listed in the following table.

Item type

Object

Meeting

Appointment

Message

Message

The following JavaScript code example shows how to access the subject property of the current item in Outlook. Note that the current item can be a Message object or Appointment object, both of which extend the Item object.

// The initialize function is required for all apps.
Office.initialize = function () {
    // Checks for the DOM to load using the jQuery ready function.
    $(document).ready(function () {
    // After the DOM is loaded, app-specific code can run.
    var item = Office.context.mailbox.item;
    var subject = item.subject;
    // Continue with processing the subject of the current item, which can be a message or appointment.
    });
}

A checkmark (√) in the following table indicates that this property is supported in the corresponding Outlook host application. An empty cell indicates that the Outlook host application doesn't support this property.

For more information about Office host application and server requirements, see Requirements for running apps for Office.

Supported hosts, by platform

Office for Windows desktop

Office Online
(in browser)

OWA for Devices

Office for Mac

Outlook

√ (Read mode only)

Available in requirement sets

Mailbox

Minimum permission level

ReadItem

App types

Mail

Library

Office.js

Namespace

Office

Version

Changes

1.2

Added support for getSelectedDataAsync and setSelectedDataAsync.

1.0

Introduced

Show:
© 2015 Microsoft