Export (0) Print
Expand All

CustomProperties.saveAsync method (JavaScript API for Office v1.1)

JavaScript API for Office v1.1

Saves item-specific custom properties to the Exchange Server 2013.

Last modified: June 12, 2014

Applicable Outlook modes

Compose or read

Available in requirement sets

Mailbox

saveAsync(callback, userContext)

callback

The method to call when an asynchronous call is complete. Optional.

userContext

Any state data that is passed to the saveAsync method. Optional.

You must call the saveAsync method to persist any changes made with the set method or the remove method of the CustomProperties object. The saving action is asynchronous. When the asynchronous call finishes, the method specified in the callback parameter is called by using one parameter, asyncResult. You can use the optional userContext parameter to pass any state information to the callback function. The callback parameter is optional.

The following JavaScript code sample shows how to asynchronously use the Item.loadCustomPropertiesAsync method to load custom properties that are specific to the current item in Microsoft Outlook, and the CustomProperties.saveAsync method to save these properties back to Exchange Server 2013. After loading the custom properties, the code sample 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 item = Office.context.mailbox.item;
    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