OpenDocumentFile Method (ModelPath, OpenOptions, IOpenFromCloudCallback)


Opens a document from disk or cloud.

Namespace: Autodesk.Revit.ApplicationServices
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since:  2019

Syntax

C#
public Document OpenDocumentFile(
	ModelPath modelPath,
	OpenOptions openOptions,
	IOpenFromCloudCallback openFromCloudCallback
)
Visual Basic
Public Function OpenDocumentFile ( _
	modelPath As ModelPath, _
	openOptions As OpenOptions, _
	openFromCloudCallback As IOpenFromCloudCallback _
) As Document
Visual C++
public:
Document^ OpenDocumentFile(
	ModelPath^ modelPath, 
	OpenOptions^ openOptions, 
	IOpenFromCloudCallback^ openFromCloudCallback
)

Parameters

modelPath
Type: Autodesk.Revit.DBModelPath
The file to be opened.
openOptions
Type: Autodesk.Revit.DBOpenOptions
Options for opening the file.
openFromCloudCallback
Type: Autodesk.Revit.DBIOpenFromCloudCallback
The interface implementation to use when opening a cloud document. Only used for opening cloud model.

Return Value

The opened document.

Remarks

This method opens the document into memory but does not make it visible to the user in any way. If the user currently has ownership of elements in this model and there is no local model on this machine, Revit will post a warning.

Exceptions

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentException The modelPath to be opened is empty.
Autodesk.Revit.ExceptionsArgumentNullException A non-optional argument was null
Autodesk.Revit.ExceptionsCannotOpenBothCentralAndLocalException Cannot open the local model and the central model in the same Revit session. You can close one to open the other in the same Revit session.
Autodesk.Revit.ExceptionsCentralModelAccessDeniedException Access to the central model was denied. A possible reason is because the model was under maintenance.
Autodesk.Revit.ExceptionsCentralModelContentionException The model on the RevitServer is being accessed by other users. -or- The central model is locked by another client.
Autodesk.Revit.ExceptionsCentralModelException Revit encountered serious errors while trying to open the central model. -or- An internal error happened on the central model, please contact the server administrator.
Autodesk.Revit.ExceptionsCorruptModelException There are too many corrupt elements to open this model.
Autodesk.Revit.ExceptionsFileAccessException File cannot be opened in Revit LT because it was last saved in a version of Revit prior to 8.1. -or- File has an invalid extension. Try changing the file's extension and opening it again.
Autodesk.Revit.ExceptionsFileNotFoundException The modelPath to be opened doesn't exist. -or- File Not Found
Autodesk.Revit.ExceptionsInsufficientResourcesException This computer does not have enough memory, disk space, or other necessary resource to open the model.
Autodesk.Revit.ExceptionsInvalidOperationException Open is temporarily disabled. -or- The cloud model is not saved in current release of Revit. -or- The model is not allowed to access. -or- The document can not be opened. -or- Revit cannot save the transmitted model as a new central because it is already opened.
Autodesk.Revit.ExceptionsOperationCanceledException Opening was canceled by the user or by an API event callback.
Autodesk.Revit.ExceptionsRevitServerCommunicationException The server-based central model could not be accessed because of a network communication error.
Autodesk.Revit.ExceptionsRevitServerInternalException An internal error happened on the server, please contact the server administrator.
Autodesk.Revit.ExceptionsRevitServerUnauthorizedException User is not authorized to access the cloud model.
Autodesk.Revit.ExceptionsWrongUserException The local file is not owned by the current user, who therefore is not allowed to modify it.

See Also