Transaction.RollBack(FailureHandlingOptions) Method

TransactionRollBack(FailureHandlingOptions) Method

Rolls back all changes made to the model during the transaction.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.3.0.0 (25.3.0.0)
Syntax
public TransactionStatus RollBack(
	FailureHandlingOptions options
)
Public Function RollBack ( 
	options As FailureHandlingOptions
) As TransactionStatus
public:
TransactionStatus RollBack(
	FailureHandlingOptions^ options
)
member RollBack : 
        options : FailureHandlingOptions -> TransactionStatus 

Parameters

options  FailureHandlingOptions
A set of options to be used for handling eventual failures during this call.

The options are only used temporarily during this rolling back process. After the transaction is finished, the options will be reset to their default values.

Return Value

TransactionStatus
If finished successfully, this method returns TransactionStatus.RolledBack.

Be aware that the returned status does not have to be necessarily the same like the status returned by GetStatus even when the method is called immediately after rolling back the transaction. Such difference may happen due to actions made by a transaction finalizer, if there was one set. (See FailureHandlingOptions for more details.)

Exceptions
ExceptionCondition
ArgumentNullException A non-optional argument was null
InvalidOperationException The current status of the transaction is not 'Started'. Transaction must be started before calling Commit or Rollback. -or- The transaction's document is currently in failure mode. No transaction operations are permitted until failure handling is finished.
Remarks
By rolling back a transaction, all changes made to the model are discarded. RollBack may only be called for a transaction that has been started. (Use the GetStatus method to check the current state.) Be aware that rolling back may be delayed (as a result of failure handling.) Callers should always check the returned status to test whether a transaction was rolled back successfully. Only after rolling back is fully completed, the transaction may be started again.
See Also