AsyncResult

Every callback function has access to the AsyncResult object.
What is returned to the AsyncResult.value property varies depending on the functionality of the "Async" method.


AsyncResult.value

Access the values in the current selection in the format that was specified.


AsyncResult.status

Determines the success or failure of the operation.


AsyncResult.error

Provides error information if the operation failed.


AsyncResult.asyncContext

Returns the user defined item passed in to the AsyncContext parameter.


function getDataWithContext() { 
   var format = "your data : ";

   Office.context.document.getSelectedDataAsync(
      Office.CoercionType.Text,
      { asyncContext : format },
      callback_showDataWithContext
      );
}

function callback_showDataWithContext(result) {
   showMessage(result.asyncContext + result.value);
}

result Parameter

This result parameter is of type AsyncResult
Any callback functions must include a single parameter "result"



© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext