DocumentCreating Event


Subscribe to the DocumentCreating event to be notified when Revit is just about to create a new document.

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

Syntax

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

Remarks

This event is raised when Revit is just about to create a new document.

Event is cancellable. To cancel it, call the 'Cancel()' method of event's argument to True. Your application is responsible for providing feedback to the user about the reason for the cancellation.

The document cannot be modified, for it is not created yet at the time of the event.

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 DocumentCreated event will be raised immediately after document creation is finished.

See Also