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

JavaScript API for Office v1.1

Saves the settings.

Last modified: November 24, 2014



Type: object

A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. Optional.

When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter.

In the callback function passed to the saveAsync method, you can use the properties of the AsyncResult object to return the following information.


Use to...


Always returns undefined because there is no object or data to retrieve.


Determine the success or failure of the operation.


Access an Error object that provides error information if the operation failed.


Access your user-defined object or value, if you passed one as the asyncContext parameter.

Any settings previously saved by an app are loaded when it is initialized, so during the lifetime of the session you can just use the set and get methods to work with the in-memory copy of the settings property bag. When you want to persist the settings so that they are available the next time the app is used, use the saveAsync method.

function persistSettings() {
    Office.context.roamingSettings.saveAsync(function (asyncResult) {
        write('Settings saved with status: ' + asyncResult.status);
// Function that writes to a div with id='message' on the page.
function write(message){
    document.getElementById('message').innerText += message; 

App types

Mail apps

Supported clients

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





© 2014 Microsoft