2024 Method
Changes 4
M

UIApplication.OpenAndActivateDocument

Description:
Opens and activates a Revit document, include both local document or cloud document.
Remarks:
This method, if successful, changes the active document. The model will override the local change with the latest change if it is a cloud model and it was restored, or relinquished, or out of date. It is not allowed to have an open transaction in the active document when calling this method. Consequently, this method can only be used in manual transaction mode, not in automatic mode. Additionally, this method may not be called from inside an event handler.
Overloads (3):
OpenAndActivateDocument(ModelPath,OpenOptions,Boolean)
public UIDocument OpenAndActivateDocument(
	ModelPath modelPath,
	OpenOptions openOptions,
	bool detachAndPrompt
)
  • modelPath
    A path to a Revit file to be opened. The file can be either a Revit project, template, or family document.
  • openOptions
    Options for opening the file.
  • Boolean
    detachAndPrompt
    True means if openOptions specifies DoNotDetach, then for workshared models detach from central and query the user whether to preserve or discard worksets. make no sense when opening a cloud document.
Return Value The opened document. The opened document.