# IMessaging.Cancel()

Description:

The `Cancel` method cancels an outstanding asynchronous `Send` or `RegisterNotification` call.

Note: To cancel a `RegisterNotification` call, use `CancelNotification` instead, as it provides a more convenient way of doing this.

This is a synchronous method.

Syntax:

    result = so.IMessaging.Cancel(criteria);

Arguments:

- `criteria`:

  This is an object with the `TransactionID` property (number). `criteria.TransactionID` specifies the transaction ID of the `Send` or `RegisterNotification` call to cancel. The transaction ID is the `result.TransactionID` value that was returned as part of the result of the initial call.

Return value:

The `Cancel` method returns an object that contains an error code and an error message.

Table: Return value properties for Cancel
Property | Description | Value
--- | --- | ---
`result.ErrorCode` | This is a number that specifies a predefined error code. | See Service API error codes.
`result.ErrorMessage` | This is a text string that describes the error. | See Messaging Service API error messages.

Example code:

For the complete source of a sample widget that demonstrates how to use this Service API, see the full example.