Asynchronous - Callback Values

Every callback function has access to the AsyncResult object.


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(resultt.asyncContext + result.value);
}


result Parameter

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



© 2017 Better Solutions Limited. All Rights Reserved. © 2017 Better Solutions Limited

PrevNext