Office.Subject interface

Provides methods to get and set the subject of an appointment or message in an Outlook add-in.

[ API set: Mailbox 1.1 ]

Remarks

Minimum permission levelReadItem
Applicable Outlook modeCompose

Methods

getAsync(options, callback)

Gets the subject of an appointment or message.

The getAsync method starts an asynchronous call to the Exchange server to get the subject of an appointment or message.

[ API set: Mailbox 1.1 ]

getAsync(callback)

Gets the subject of an appointment or message.

The getAsync method starts an asynchronous call to the Exchange server to get the subject of an appointment or message.

[ API set: Mailbox 1.1 ]

setAsync(subject, options, callback)

Sets the subject of an appointment or message.

The setAsync method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place.

[ API set: Mailbox 1.1 ]

setAsync(data)

Sets the subject of an appointment or message.

The setAsync method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place.

[ API set: Mailbox 1.1 ]

setAsync(data, callback)

Sets the subject of an appointment or message.

The setAsync method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place.

[ API set: Mailbox 1.1 ]

Method Details

getAsync(options, callback)

Gets the subject of an appointment or message.

The getAsync method starts an asynchronous call to the Exchange server to get the subject of an appointment or message.

[ API set: Mailbox 1.1 ]

getAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult<string>) => void): void;

Parameters

options
Office.AsyncContextOptions

An object literal that contains one or more of the following properties. asyncContext: Developers can provide any object they wish to access in the callback method.

callback
(result: Office.AsyncResult<string>) => void

When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. The value property of the result is the subject of the item.

Returns

void

Remarks

Minimum permission levelReadItem
Applicable Outlook modeCompose

getAsync(callback)

Gets the subject of an appointment or message.

The getAsync method starts an asynchronous call to the Exchange server to get the subject of an appointment or message.

[ API set: Mailbox 1.1 ]

getAsync(callback: (result: Office.AsyncResult<string>) => void): void;

Parameters

callback
(result: Office.AsyncResult<string>) => void

When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. The value property of the result is the subject of the item.

Returns

void

Remarks

Minimum permission levelReadItem
Applicable Outlook modeCompose

Examples

Office.context.mailbox.item.subject.getAsync(callback);

function callback(asyncResult) {
    var subject = asyncResult.value;
}

setAsync(subject, options, callback)

Sets the subject of an appointment or message.

The setAsync method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place.

[ API set: Mailbox 1.1 ]

setAsync(subject: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult<void>) => void): void;

Parameters

subject
string

The subject of the appointment or message. The string is limited to 255 characters.

options
Office.AsyncContextOptions

An object literal that contains one or more of the following properties. asyncContext: Developers can provide any object they wish to access in the callback method.

callback
(result: Office.AsyncResult<void>) => void

When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. If setting the subject fails, the asyncResult.error property will contain an error code.

Returns

void

Remarks

Minimum permission levelReadItem
Applicable Outlook modeCompose
ErrorsDataExceedsMaximumSize - The subject parameter is longer than 255 characters.

setAsync(data)

Sets the subject of an appointment or message.

The setAsync method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place.

[ API set: Mailbox 1.1 ]

setAsync(data: string): void;

Parameters

data
string

Returns

void

Remarks

Minimum permission levelReadItem
Applicable Outlook modeCompose
ErrorsDataExceedsMaximumSize - The subject parameter is longer than 255 characters.

setAsync(data, callback)

Sets the subject of an appointment or message.

The setAsync method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place.

[ API set: Mailbox 1.1 ]

setAsync(data: string, callback: (result: Office.AsyncResult<void>) => void): void;

Parameters

data
string
callback
(result: Office.AsyncResult<void>) => void

When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. If setting the subject fails, the asyncResult.error property will contain an error code.

Returns

void

Remarks

Minimum permission levelReadItem
Applicable Outlook modeCompose
ErrorsDataExceedsMaximumSize - The subject parameter is longer than 255 characters.

Examples

Office.context.mailbox.item.subject.setAsync("New subject!", function (asyncResult) {
    if (asyncResult.status === "failed") {
        console.log("Action failed with error: " + asyncResult.error.message);
    }
});