Revit 2026 API
DocumentEnable |
Enables worksharing in the document.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 26.0.4.0 (26.0.4.0)
Syntax
public void EnableWorksharing( string worksetNameGridLevel, string worksetName )
Public Sub EnableWorksharing ( worksetNameGridLevel As String, worksetName As String )
public: void EnableWorksharing( String^ worksetNameGridLevel, String^ worksetName )
member EnableWorksharing : worksetNameGridLevel : string * worksetName : string -> unit
Parameters
- worksetNameGridLevel String
- Name of workset for grids and levels.
- worksetName String
- Name of workset for all other elements.

Exception | Condition |
---|---|
ArgumentException | worksetNameGridLevel is an empty string. -or- worksetName is an empty string. -or- worksetNameGridLevel cannot include prohibited characters, such as "{, }, [, ], |, ;, less-than sign, greater-than sign, ?, `, ~". -or- worksetName cannot include prohibited characters, such as "{, }, [, ], |, ;, less-than sign, greater-than sign, ?, `, ~". |
ArgumentNullException | A non-optional argument was null |
ForbiddenForDynamicUpdateException | This method may not be called during dynamic update. |
InvalidOperationException | The document does not allow worksharing to be enabled. -or- This Document is in an edit mode. -or- This Document is a workshared document. -or- There is a transaction phase left open (such as a transaction, sub-transaction of transaction group) at the time of invoking this method. |
OperationCanceledException | Enabling worksharing was cancelled. |

The document's Undo history will be cleared by this command. As a result, this command and others executed before it cannot be undone.
All transaction phases (e.g. transactions transaction groups and sub-transaction) that were explicitly started must be finished prior to calling this method.
See Also