Export (0) Print
Expand All

AsyncResult.value property (JavaScript API for Office v1.1)

JavaScript API for Office v1.1

Gets the payload or content of this asynchronous operation, if any.

Last modified: November 24, 2014

var dataValue = asyncResult.value;

Returns the value of the request at the time the asynchronous call was made.

Note Note

What the value property returns for a particular "Async" method varies depending on the purpose and context of that method. To determine what is returned by the value property for an "Async" method, refer to the "Callback value" section of the method's topic. For a complete listing of the "Async" methods, see the Remarks section of the AsyncResult object topic.

You access the AsyncResult object in the function passed as the argument to the callback parameter of an "Async" method, such as the getSelectedDataAsync and setSelectedDataAsync methods of the Document object.

function getData() {
    Office.context.document.getSelectedDataAsync(Office.CoercionType.Table, function(asyncResult) {
        if (asyncResult.status == Office.AsyncResultStatus.Failed) {
            write(asyncResult.error.message);
        }
        else {
            write(asyncResult.value);
        }
    });
}
// Function that writes to a div with id='message' on the page.
function write(message){
    document.getElementById('message').innerText += message; 
}

App types

Content app, Mail app, Task pane app

Supported clients

Access app for SharePoint, Excel 2013, Excel 2013 SP1, Excel 2013 RT, Excel Online, Word 2013, Word 2013 SP1, Word 2013 RT, Outlook 2013, Outlook 2013 SP1, Outlook 2013 RT, Outlook Web App, OWA for Devices, Outlook for Mac, PowerPoint 2013, PowerPoint 2013 SP1, PowerPoint 2013 RT, Project 2013, Project 2013 SP1

Library

Office.js

Namespace

Office

Show:
© 2014 Microsoft