Close the document, prompting the user for saving it when necessary.
Namespace: Autodesk.Revit.UI
Assembly: RevitAPIUI (in RevitAPIUI.dll) Version: 26.2.0.0 (26.2.0.0)
Syntax
C#
public bool SaveAndClose()
Return Value
BooleanFalse if closing procedure fails or if saving of a modified document was requested but failed. Also returns False if closing is cancelled by an external application during 'DocumentClosing' event. When function succeeds, True is returned.
Exceptions
Exception | Condition |
---|---|
InvalidOperationException | Thrown when attempting to close the currently active document. Thrown if there are any transactions, sub-transactions or transaction groups which were opened by the API code, and not closed. All of these items must be handled before attempting to close the document. |
InvalidOperationException | Thrown if this a linked file. |