RollBack Method


Discards all changes made to the model during the sub-transaction.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Since: 2011

Syntax

C#
public TransactionStatus RollBack()
Visual Basic
Public Function RollBack As TransactionStatus
Visual C++
public:
TransactionStatus RollBack()

Return Value

If finished successfully, this method returns TransactionStatus.RolledBack.

Remarks

The parent transaction (or a parent sub-transaction, if any) can still be committed, but the changes rolled back by this method will not be part of the committed transaction.

RollBack can be called only when all inner sub-transaction, if any, are finished, i.e. they were either committed or rolled back. If there is still a sub-transaction open, an attempt to roll this outer sub-transaction back will cause an exception.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions InvalidOperationException A sub-transaction can only be active inside an open Transaction. -or- The sub-transaction's current status is not TransactionStatus.Started, therefore it may not be committed or rolled back.

See Also

ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →