Ewa.AsyncResult.getSucceeded()
Applies to: apps for SharePoint | Excel Services | SharePoint Server 2013
In this article
Return Value
Remarks
Example
Specifies whether the asynchronous operation is successful.
var value = Ewa.AsyncResult.getSucceeded();
Return Value
Type: Boolean
true if the asynchronous call succeeded.
Remarks
The [AsyncResult] object is passed as an argument to the callback specified in the asynchronous method call. If an error occurs during an asynchronous operation, the [AsyncResult] object will contain information about the error. The [AsyncResult.getSucceeded] method returns a Boolean value that specifies whether or not the asynchronous operation succeeded.
Example
The following code example shows how to determine whether or not the asynchronous operation succeeded. The code example assumes that you are working with an Excel Web Access Web Part on SharePoint Server 2013.
<script type="text/javascript">
var ewa = null;
// Add event handler for onload event.
if (window.attachEvent)
{
window.attachEvent("onload", ewaOnPageLoad);
}
else
{
window.addEventListener("DOMContentLoaded", ewaOnPageLoad, false);
}
// Add event handler for applicationReady event.
function ewaOnPageLoad()
{
Ewa.EwaControl.add_applicationReady(getEwa);
}
function getEwa()
{
// Get a reference to the Ewa object.
ewa = Ewa.EwaControl.getInstances().getItem(0);
getRangeAsync();
}
function getRangeAsync()
{
// Get a range asynchronously using A1 notation.
ewa.getActiveWorkbook().getRangeA1Async("Sheet3!B2", getRangeComplete, null);
}
function getRangeComplete(asyncResult)
{
// If getRangeA1Async failed, get error code.
if (!asyncResult.getSucceeded())
{
// Get the error code.
var errorCode = asyncResult.getCode();
switch (errorCode)
{
case AsyncErrorCode.InternalError:
alert("An internal error occurred.");
break;
case AsyncErrorCode.TimedOut:
alert("The operation timed out.");
break;
case AsyncErrorCode.InvalidNamedItem:
alert("The named item is undefined or unpublished.");
break;
case AsyncErrorCode.SettingValuesError:
alert("Excel Calculation Services is unable to set the values.");
break;
case AsyncErrorCode.RangeSizeError:
alert("The array indices exceed the range columns and/or rows. Or the range columns and/or rows exceed the array indices.");
break;
} // End switch.
} // End if.
// Get the range object from the getRangeA1Async call.
var range = asyncResult.getReturnValue();
// Display the range address in A1 format.
window.status = range.getAddressA1();
}
</script>