Office.InternetHeaders interface

The InternetHeaders object represents custom internet headers that are preserved after the message item leaves Exchange and is converted to a MIME message. These headers are stored as x-headers in the MIME message.

InternetHeaders are stored as key/value pairs on a per-item basis.

Note: This object is intended for you to set and get your custom headers on a message item.

[ API set: Mailbox 1.8 ]

Remarks

Minimum permission level: ReadItem

Applicable Outlook mode: Compose

Methods

getAsync(names, options, callback)

Given an array of internet header names, this method returns a dictionary containing those internet headers and their values. If the add-in requests an x-header that is not available, that x-header will not be returned in the results.

Note: This method is intended to return the values of the custom headers you set using the setAsync method.

[ API set: Mailbox 1.8 ]

getAsync(names, callback)

Given an array of internet header names, this method returns a dictionary containing those internet headers and their values. If the add-in requests an x-header that is not available, that x-header will not be returned in the results.

Note: This method is intended to return the values of the custom headers you set using the setAsync method.

[ API set: Mailbox 1.8 ]

removeAsync(names, options, callback)

Given an array of internet header names, this method removes the specified headers from the internet header collection.

Note: This method is intended to remove the custom headers you set using the setAsync method.

[ API set: Mailbox 1.8 ]

removeAsync(names, callback)

Given an array of internet header names, this method removes the specified headers from the internet header collection.

Note: This method is intended to remove your custom headers you set using the setAsync method.

[ API set: Mailbox 1.8 ]

setAsync(headers, options, callback)

Sets the specified internet headers to the specified values.

The setAsync method creates a new header if the specified header doesn't already exist; otherwise, the existing value is replaced with the new value.

Note: This method is intended to set the values of your custom headers.

[ API set: Mailbox 1.8 ]

setAsync(headers, callback)

Sets the specified internet headers to the specified values.

The setAsync method creates a new header if the specified header doesn't already exist; otherwise, the existing value is replaced with the new value.

Note: This method is intended to set the values of your custom headers.

[ API set: Mailbox 1.8 ]

Method Details

getAsync(names, options, callback)

Given an array of internet header names, this method returns a dictionary containing those internet headers and their values. If the add-in requests an x-header that is not available, that x-header will not be returned in the results.

Note: This method is intended to return the values of the custom headers you set using the setAsync method.

[ API set: Mailbox 1.8 ]

getAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<InternetHeaders>) => void): void;

Parameters

names
string[]

The names of the internet headers to be returned.

options
Office.AsyncContextOptions

Optional. 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
(asyncResult: Office.AsyncResult<InternetHeaders>) => void

Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object.

Returns

void

Remarks

Minimum permission level: ReadItem

Applicable Outlook mode: Compose

getAsync(names, callback)

Given an array of internet header names, this method returns a dictionary containing those internet headers and their values. If the add-in requests an x-header that is not available, that x-header will not be returned in the results.

Note: This method is intended to return the values of the custom headers you set using the setAsync method.

[ API set: Mailbox 1.8 ]

getAsync(names: string[], callback?: (asyncResult: Office.AsyncResult<InternetHeaders>) => void): void;

Parameters

names
string[]

The names of the internet headers to be returned.

callback
(asyncResult: Office.AsyncResult<InternetHeaders>) => void

Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object.

Returns

void

Remarks

Minimum permission level: ReadItem

Applicable Outlook mode: Compose

Examples

Office.context.mailbox.item.internetHeaders.getAsync(["header1", "header2"], callback);

function callback(asyncResult) {
    var dictionary = asyncResult.value;
    var header1_value = dictionary["header1"];
}

removeAsync(names, options, callback)

Given an array of internet header names, this method removes the specified headers from the internet header collection.

Note: This method is intended to remove the custom headers you set using the setAsync method.

[ API set: Mailbox 1.8 ]

removeAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<InternetHeaders>) => void): void;

Parameters

names
string[]

The names of the internet headers to be removed.

options
Office.AsyncContextOptions

Optional. 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
(asyncResult: Office.AsyncResult<InternetHeaders>) => void

Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object.

Returns

void

Remarks

Minimum permission level: ReadWriteItem

Applicable Outlook mode: Compose

removeAsync(names, callback)

Given an array of internet header names, this method removes the specified headers from the internet header collection.

Note: This method is intended to remove your custom headers you set using the setAsync method.

[ API set: Mailbox 1.8 ]

removeAsync(names: string[], callback?: (asyncResult: Office.AsyncResult<InternetHeaders>) => void): void;

Parameters

names
string[]

The names of the internet headers to be removed.

callback
(asyncResult: Office.AsyncResult<InternetHeaders>) => void

Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object.

Returns

void

Remarks

Minimum permission level: ReadWriteItem

Applicable Outlook mode: Compose

Examples

Office.context.mailbox.item.internetHeaders.removeAsync(["header1", "header2"]);

setAsync(headers, options, callback)

Sets the specified internet headers to the specified values.

The setAsync method creates a new header if the specified header doesn't already exist; otherwise, the existing value is replaced with the new value.

Note: This method is intended to set the values of your custom headers.

[ API set: Mailbox 1.8 ]

setAsync(headers: Object, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;

Parameters

headers
Object

The names and corresponding values of the headers to be set. Should be a dictionary object with keys being the names of the internet headers and values being the values of the internet headers.

options
Office.AsyncContextOptions

Optional. 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
(asyncResult: Office.AsyncResult<void>) => void

Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. Any errors encountered will be provided in the asyncResult.error property.

Returns

void

Remarks

Minimum permission level: ReadWriteItem

Applicable Outlook mode: Compose

setAsync(headers, callback)

Sets the specified internet headers to the specified values.

The setAsync method creates a new header if the specified header doesn't already exist; otherwise, the existing value is replaced with the new value.

Note: This method is intended to set the values of your custom headers.

[ API set: Mailbox 1.8 ]

setAsync(headers: Object, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;

Parameters

headers
Object

The names and corresponding values of the headers to be set. Should be a dictionary object with keys being the names of the internet headers and values being the values of the internet headers.

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

Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. Any errors encountered will be provided in the asyncResult.error property.

Returns

void

Remarks

Minimum permission level: ReadWriteItem

Applicable Outlook mode: Compose

Examples

Office.context.mailbox.item.internetHeaders.setAsync({"header1": "value1", "header2": "value2"});