Transaction.Start(String) Method

TransactionStart(String) Method

Starts the transaction with an assigned name.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.3.0.0 (25.3.0.0)
Syntax
public TransactionStatus Start(
	string name
)
Public Function Start ( 
	name As String
) As TransactionStatus
public:
TransactionStatus Start(
	String^ name
)
member Start : 
        name : string -> TransactionStatus 

Parameters

name  String
Name of the transaction; If the transaction already has name, this new one will preplace it. The name will appear on the Undo menu in Revit if the transaction is successfully committed.

Return Value

TransactionStatus
If finished successfully, this method returns TransactionStatus.Started. Note that unless starting is successful, changes cannot be made to the document.
Exceptions
ExceptionCondition
ArgumentException The name argument is an empty string.
ArgumentNullException A non-optional argument was null
InvalidOperationException Cannot modify the document for either a read-only external command is being executed, or changes to the document are temporarily disabled. -or- The transaction's document is currently in failure mode. No transaction operations are permitted until failure handling is finished. -or- The transaction started already and has not been completed yet. -or- Starting a new transaction is not permitted. It could be because another transaction already started and has not been completed yet, or the document is in a state in which it cannot start a new transaction (e.g. during failure handling or a read-only mode, which could be either permanent or temporary).
Remarks

A transaction may be started only after it was instantiated or after it was previously committed or rolled back.

Be aware that every time a transaction starts, Failure Handling Options will be reset to their default values. If a specific failure handling is required, programmers need to use SetFailureHandlingOptions(FailureHandlingOptions) before the transaction is committed or rolled back.

See Also