External |
Creates an ExternalResourceReference representing a local file managed by Revit's built-in server.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)

public static ExternalResourceReference CreateLocalResource(
Document doc,
ExternalResourceType resourceType,
ModelPath path,
PathType pathType
)
Parameters
- doc Document
- The document containing the reference. If the PathType is relative, the path will be made relative to the location of this Document. (If this Document belongs to a workshared model, the reference will be relative to the central model.)
- resourceType ExternalResourceType
- The type of the external resource.
- path ModelPath
- A path to the external file. This path must be absolute. If the PathType is relative, then Revit will relativize the path according to the location of the given Document.
- pathType PathType
- An enum indicating the type of path which the ExternalResourceReference should use. The PathType must be PathType.Server if the reference is to a Revit model on Revit Server. The PathType must be PathType.Absolute if the reference is local but the host model or host's central model are on Revit Server.
Return Value
ExternalResourceReferenceThe newly-created ExternalResourceReference.

Exception | Condition |
---|---|
ArgumentException | The PathType.Enum value is not valid for this resource type or Document location. PathType.Content is not valid for Revit links. The PathType must be PathType.Server if the resource is on Revit Server and is only valid for Revit links. The PathType must be PathType.Absolute if the host document or the host document's central model are on Revit Server. -or- The given path path is a cloud path which is not supported in this method. |
ArgumentNullException | A non-optional argument was null |
ArgumentOutOfRangeException | A value passed for an enumeration argument is not a member of that enumeration |
InvalidOperationException | The model is not allowed to access. |
