Cancelling a Task

To cancel a
Task
that is still running, call the
Task.CancelTask
method, passing in the managed object reference to the
Task
you want to cancel, as shown in this example:
my_conn.cancelTask(taskMoRef);
You can only cancel a
Task
that has its
cancelable
property set to
true
and its
state
property set to
running
. The operation that initiates the
Task
sets the value of
cancelable
when it creates the
Task
. For example, a
CreateVM_Task
cannot be cancelled. Before attempting to cancel a running
Task
, you can check the values of the
cancelable
property and the
state
property of the
TaskInfo
data object associated with the
Task
.