ExternalResourceReference Class

This class identifies an external resource provided by an IExternalResourceServer.
Inheritance Hierarchy
SystemObject
  Autodesk.Revit.DBExternalResourceReference

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class ExternalResourceReference : IDisposable

The ExternalResourceReference type exposes the following members.

Constructors
 NameDescription
Public methodExternalResourceReference(ExternalResourceReference) Creates a new ExternalResourceReference from the given ExternalResourceReference.
Public methodExternalResourceReference(Guid, IDictionaryString, String, String, String) Creates a new ExternalResourceReference from the given data.
Top
Properties
 NameDescription
Public propertyInSessionPath

The path stores the full display path which includes the server name plus the path provided by ExternalResourceServer.

The path that Revit will present for user recognizing and browsing to this resource during one session of Revit.

This property allows ExternalResourceServers to handle cases where the path to a resource may vary between Revit sessions. For example, if this ExternalResourceReference refers to a resource in a folder, this property can be used to store the current path of the resource. If the resource is moved to another folder later, the ExternalResourceServer could calculate the correct path for the resource from resource identification information when it is loaded and store it in this property, so that it will work correctly even if the rvt file is opened in a different location.

Do not rely on this path to look up an ExternalResourceReference, as the path is neither unique nor stable. It isn't unique because multiple servers might use the same server name and display name format. It isn't stable because some servers allow renaming, and because a server might change its name at some point.

Public propertyIsValidObject Specifies whether the .NET object represents a valid Revit entity.
Public propertyServerId The id of the server that Revit is expecting to provide the external resource.
Public propertyVersion The version of the external data that was most recently loaded in Revit.
Top
Methods
 NameDescription
Public methodStatic memberCreateLocalResource Creates an ExternalResourceReference representing a local file managed by Revit's built-in server.
Public methodDisposeReleases all resources used by the ExternalResourceReference
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetReferenceInformation Returns a copy of an object containing previously-stored reference or lookup information about the specific resource provided by the server.
Public methodGetResourceShortDisplayName Gets the short display name of the external resource.
Public methodGetResourceVersionStatus Checks whether this ExternalResourceReference corresponds to the current version of the resource.
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodHasValidDisplayPath Checks whether this external Resource has a valid display path.
Public methodIsValidReference Checks whether the reference is in a valid format.
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Remarks

The class contains:

  • The id of the IExternalResourceServer from which the resource was obtained.
  • A (String, String) map containing information that is meaningful to the server for accessing the desired data. This could be something as simple as "4" to indicate that Revit wants option 4 from a range of several choices, or something more detailed, such as a filename or directory path.
  • A String indicating the version of the resource that was most recently loaded in Revit.
  • A (String, String) map containing "in session" information that is meaningful to the server, but which does not need to be saved permanently in the document on disk.

When calling an IExternalResourceServer, Revit will provide an ExternalResourceReference to identify the specific resource that Revit is using from that server. The server can then use the relevant information in the (String, String) maps to retrieve the data from the correct source.

See Also