This topic has not yet been rated - Rate this topic

Error.message property (JavaScript API for Office v1.0)

JavaScript API for Office v1.0

Gets a detailed description of the error.

Last modified: November 01, 2013

var errMessage = asyncResult.error.message;

The description of the error as a string.

The Error object and its properties are accessed from the AsyncResult object that is returned in the function passed as the callback argument of an asynchronous data operation.

To cause an error to be thrown, select a table or a matrix, and then call the setText function.

function setText() {
    Office.context.document.setSelectedDataAsync("Hello World!",
        function (asyncResult) {
            if (asyncResult.status === "failed")
                var error = asyncResult.error;
            write( + ": " + error.message);

// Function that writes to a div with id='message' on the page.
function write(message){
    document.getElementById('message').innerText += message; 

Supported clients

Excel 2013, Excel Web App, Outlook 2013, Outlook Web App, OWA for Devices, PowerPoint 2013, Project 2013, and Word 2013





© 2014 Microsoft. All rights reserved.