Get and set item data in a compose form in Outlook

apps for Office

Learn how to get or set various properties of an item in a compose scenario, including its recipients, subject, body, and appointment location and time.

Last modified: November 13, 2014

Applies to: Exchange Online | Exchange Server 2013 SP1 | Outlook 2013 RT | Outlook 2013 SP1 | Outlook Web App | OWA for Devices

   Office.js: v1.1

   Apps for Office manifests schema: v1.1

Note Note

In this article, "Outlook" refers to Outlook for Windows, Outlook RT, OWA for Devices, and Outlook Web App. This article doesn't apply to Outlook for Mac. At this point, Outlook for Mac supports JavaScript API for Office in only Outlook read mode, and can activate mail apps that reference office.js version 1.0 or 1.1 and use apps for Office schema version 1.0.

In this article
Getting and setting item properties for a compose app
In this section
Additional resources

In a compose form, you can get most of the properties that are exposed on the same kind of item as in a read form (such as attendees, recipients, subject, and body), and you can get a few extra properties that are relevant in only a compose form but not a read form (body, bcc).

For most of these properties, because it’s possible that a mail app and the user can be modifying the same property in the user interface at the same time, the methods to get and set them are asynchronous. Table 1 lists the item-level properties and corresponding asynchronous methods to get and set them in a compose form. The Item.itemType and Message.conversationId properties are exceptions because users cannot modify them. You can programmatically get them the same way in a compose form as in a read form, directly from the parent object.

Other than accessing item properties in the JavaScript API for Office, you can access item-level properties using Exchange Web Services (EWS). With the ReadWriteMailbox permission, you can use the Mailbox.makeEwsRequestAsync method to access EWS operations, GetItem and UpdateItem, to get and set more properties of an item or items in the user’s mailbox. makeEwsRequestAsync is available in both compose and read forms. For more information about the ReadWriteMailbox permission, and accessing EWS through the apps for Office platform, see Specify permissions for mail app access to the user's mailbox and Call web services from a mail app for Outlook.

Table 1. Asynchronous methods to get or set item properties in a compose form

Item

Property

Property type

Asynchronous method to get

Asynchronous method(s) to set

Appointment

body

Body

Body.getTypeAsync

Body.prependAsync

Body.setSelectedDataAsync

end

Time

Time.getAsync

Time.setAsync

location

Location

Location.getAsync

Location.setAsync

optionalAttendees

Recipients

Recipients.getAsync

Recipients.addAsync

Recipients.setAsync

requiredAttendees

Recipients

Recipients.getAsync

Recipients.addAsync

Recipients.setAsync

start

Time

Time.getAsync

Time.setAsync

subject

Subject

Subject.getAsync

Subject.setAsync

Message

bcc

Recipients

Recipients.getAsync

Recipients.addAsync

Recipients.setAsync

body

Body

Body.getTypeAsync

Body.prependAsync

Body.setSelectedDataAsync

cc

Recipients

Recipients.getAsync

Recipients.addAsync

Recipients.setAsync

subject

Subject

Subject.getAsync

Subject.setAsync

to

Recipients

Recipients.getAsync

Recipients.addAsync

Recipients.setAsync

Show:
© 2015 Microsoft