This topic has not yet been rated - Rate this topic

CustomProperties object (apps for Office)

apps for Office

Published: February 26, 2013

Provides a collection of item-specific custom properties.

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

Method name

Description

get

Gets the specified custom property.

remove

Removes the specified custom property.

saveAsync

Saves the custom property collection to the server.

set

Creates or updates the specified custom property.

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) {
}

Supported clients

Outlook 2013 and Outlook Web App

Library

Outlook-15.js, OutlookWebApp-15.js

Namespace

Office

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.