CustomProperties object (JavaScript API for Office v1.1)

JavaScript API for Office v1.1

Provides a collection of item-specific custom properties.

Last modified: June 12, 2014

Applicable Outlook modes

Compose or read

Available in requirement sets

Mailbox

Office.context.mailbox.item.loadCustomPropertiesAsync(customPropsCallback);

Methods

Method name

Outlook mode

Description

Introduced in

get

Compose or read

Gets the specified custom property.

Version 1.0

remove

Compose or read

Removes the specified custom property.

Version 1.0

saveAsync

Compose or read

Saves the custom property collection to the server.

Version 1.0

set

Compose or read

Creates or updates the specified custom property.

Version 1.0

The CustomProperties object represents custom properties that are specific to a particular item and specific to a mail app for Outlook. For example, there might be a need for a mail app to save some data that is specific to the current email message that activated the app. If the user revisits the same message in the future and activates the mail app again, the app will be able to retrieve the data that had been saved as custom properties.

The following example shows how to use the Item.loadCustomPropertiesAsync method to asynchronously load custom properties that are specific to the current item in Microsoft Outlook. The example also shows how to use the CustomProperties.saveAsync method to save these properties back to the Exchange server. After loading the custom properties, the example uses the CustomProperties.get method to read the custom property myProp, the CustomProperties.set method to write the custom property otherProp, and then finally calls the saveAsync method to save the custom properties.

// 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 mailbox = Office.context.mailbox;
    mailbox.item.loadCustomPropertiesAsync(customPropsCallback);
    });
}
function customPropsCallback(asyncResult) {
    var customProps = asyncResult.value;
    var myProp = customProps.get("myProp");

    customProps.set("otherProp", "value");
    customProps.saveAsync(saveCallback);
}

function saveCallback(asyncResult) {
}

App types

Mail app

Supported clients

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

Library

Office.js

Namespace

Office

Show:
© 2014 Microsoft