Export (0) Print
Expand All

Body.setSelectedDataAsync method (JavaScript API for Office v1.1)

Replaces the selection in the body with the specified text. This method was introduced in version 1.1.

Last modified: June 26, 2014

Applicable Outlook modes

Compose

Available in requirement sets

Mailbox

Office.context.mailbox.item.body.setSelectedDataAsync(data, [options,] callback);

data

The string to be inserted in the body. The string is limited to 1,000,000 characters.

options

Any optional parameters or state data passed to the method. Optional.

callback

The method to call when the data is inserted. Optional.

The setSelectedDataAsync method inserts the specified string at the cursor location in the body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the UI, the string will be inserted at the top of the body content.

If you specify a callback method, the method is called with one parameter, asyncResult, which contains a code that indicates any error that occurred while adding the data.

Error code

Description

DataExceedsMaximumSize

The data parameter is longer than 1,000,000 characters.

InvalidFormatError

The body type is set to HTML and the data parameter contains plain text.

App types

Mail app

Supported clients

Outlook 2013 SP1, Outlook 2013 RT, Outlook Web App, and OWA for Devices

Library

Office.js

Namespace

Office

Show:
© 2015 Microsoft