2022 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. 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,IOpenFromCloudCallback)
public UIDocument OpenAndActivateDocument(
	ModelPath modelPath,
	OpenOptions openOptions,
	bool detachAndPrompt,
	IOpenFromCloudCallback openFromCloudCallback
)
  • 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.
  • openFromCloudCallback
    Callback function that allow caller to handle cases when conflicts happen during opening a cloud document. Make no sense when opening a non-cloud document.
Return Value The opened document. The opened document.