DocumentSaving Event


Subscribe to the DocumentSaving event to be notified when Revit is just about to save a document.

Namespace: Autodesk.Revit.ApplicationServices
Assembly: RevitAPI (in RevitAPI.dll) Version: 17.0.0.0 (17.0.1090.0)
Since: 2010

Syntax

C#
public event EventHandler<DocumentSavingEventArgs> DocumentSaving
Visual Basic
Public Event DocumentSaving As EventHandler(Of DocumentSavingEventArgs)
Visual C++
public:
 event EventHandler<DocumentSavingEventArgs^>^ DocumentSaving {
	void add (EventHandler<DocumentSavingEventArgs^>^ value);
	void remove (EventHandler<DocumentSavingEventArgs^>^ value);
}

Remarks

This event is raised when Revit is just about to save the document. Note that the first save of a newly created document will raise DocumentSavingAs rather than the DocumentSaving event.

Handlers of this event are permitted to make modifications to any document (including the active document), except for documents that are currently in read-only mode.

This event is cancellable, except when it is raised during close of the application. Check the 'Cancellable' property of event's argument to see whether it is cancellable or not. When it is cancellable, call the 'Cancel()' method of event's argument to cancel it. Your application is responsible for providing feedback to the user about the reason for the cancellation.

The following API functions are not available for the current document during this event:

Exception InvalidOperationException will be thrown if any of the above methods is called during this event.

Another event DocumentSaved will be raised immediately after the document has been saved.

See Also