DeleteWorkset Method


Delete the specific workset.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since:  2022.1

Syntax

C#
public static void DeleteWorkset(
	Document document,
	WorksetId worksetId,
	DeleteWorksetSettings deleteWorksetSettings
)
Visual Basic
Public Shared Sub DeleteWorkset ( _
	document As Document, _
	worksetId As WorksetId, _
	deleteWorksetSettings As DeleteWorksetSettings _
)
Visual C++
public:
static void DeleteWorkset(
	Document^ document, 
	WorksetId^ worksetId, 
	DeleteWorksetSettings^ deleteWorksetSettings
)

Parameters

document
Type: Autodesk.Revit.DBDocument
The document containing the worksets.
worksetId
Type: Autodesk.Revit.DBWorksetId
The id of the workset to delete.
deleteWorksetSettings
Type: Autodesk.Revit.DBDeleteWorksetSettings
The settings to delete a workset.

Remarks

Please checkout the workset before executing this method. The method may fail in some situations that mentioned in CanDeleteWorkset(Document, WorksetId, DeleteWorksetSettings). Another failure case is the Transaction failure due to "Deleting all open views in a project is not allowed."

Exceptions

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentException document is not a workshared document. -or- document is not a primary document, it is a linked document. -or- document is read-only: It cannot be modified. -or- There is no workset in the document with this id. -or- Workset cannot be deleted.
Autodesk.Revit.ExceptionsArgumentNullException A non-optional argument was null
Autodesk.Revit.ExceptionsModificationForbiddenException The document is in failure mode: an operation has failed, and Revit requires the user to either cancel the operation or fix the problem (usually by deleting certain elements). -or- The document is being loaded, or is in the midst of another sensitive process.
Autodesk.Revit.ExceptionsModificationOutsideTransactionException The document has no open transaction.
Autodesk.Revit.ExceptionsRegenerationFailedException The document regeneration fails during the DeleteWorkset operation.

See Also