TransmissionData Class

A class representing information on all external file references in a document.
Inheritance Hierarchy
SystemObject
  Autodesk.Revit.DBTransmissionData

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

The TransmissionData type exposes the following members.

Constructors
 NameDescription
Public methodTransmissionData Constructs a TransmissionData from another TransmissionData
Top
Properties
 NameDescription
Public propertyIsTransmitted Determines whether this file has been transmitted or not.
Public propertyIsValidObject Specifies whether the .NET object represents a valid Revit entity.
Public propertyUserData A string which users can store notes in.
Public propertyVersion The format version for TransmissionData
Top
Methods
 NameDescription
Public methodDisposeReleases all resources used by the TransmissionData
Public methodStatic memberDocumentIsNotTransmitted Determines whether the document at a given file location is not transmitted.
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodGetAllExternalFileReferenceIds Gets the ids of all ExternalFileReferences.
Public methodGetDesiredReferenceData Gets the ExternalFileReference representing path and load status information to be used the next time this TransmissionData's document is loaded.
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetLastSavedReferenceData Gets the ExternalFileReference representing path and load status information concerning the most recent time this TransmissionData's document was opened.
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodStatic memberIsDocumentTransmitted Determines whether the document at a given file location is transmitted.
Public methodStatic memberReadTransmissionData Reads the TransmissionData associated with the file at the given location.
Public methodSetDesiredReferenceData Sets the ExternalFileReference information which Revit should use the next time it opens the document which this TransmissionData belongs to.
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Public methodStatic memberWriteTransmissionData Writes the given TransmissionData into the Revit file at the given location.
Top
Remarks

TransmissionData stores information on both the previous state and requested state of an external file reference. This means that it stores the load state and path of the reference from the most recent time this TransmissionData's document was opened. It also stores load state and path information for what Revit should do the next time the document is opened.

As such, TransmissionData can be used to perform operations on external file references without having to open the entire associated Revit document. The methods ReadTransmissionData and WriteTransmissionData can be used to obtain information about external references, or to change that information. For example, calling WriteTransmissionData with a TransmissionData object which has had all references set to LinkedFileStatus.Unloaded would cause no references to be loaded upon next opening the document.

TransmissionData cannot add or remove references to external files. If, on file open, Revit discovers information in the TransmissionData which does not correspond to an existing external file reference, the information will be ignored on file load.

The TransmissionData for a document does not contain information about references which come from external servers. TransmissionData only contains references to local files or Revit links on Revit Server. TransmissionData cannot be used to change a reference from a local file reference to an external server reference.

Note that TransmissionData objects must be set to "transmitted" for the requested reference data to be meaningful. Revit ignores the TransmissionData for non-transmitted files. Marking a file as transmitted has other effects - workshared files are opened as detached from the central model, and creation of new local files is prohibited, until the file is in its final location and the file has been marked as no longer transmitted.

Example
void UnloadRevitLinks(ModelPath location)
///  This method will set all Revit links to be unloaded the next time the document at the given location is opened. 
///  The TransmissionData for a given document only contains top-level Revit links, not nested links.
///  However, nested links will be unloaded if their parent links are unloaded, so this function only needs to look at the document's immediate links. 
{
   // access transmission data in the given Revit file
   TransmissionData transData = TransmissionData.ReadTransmissionData(location);

   if (transData != null)
   {
      // collect all (immediate) external references in the model
      ICollection<ElementId> externalReferences = transData.GetAllExternalFileReferenceIds();

      // find every reference that is a link
      foreach (ElementId refId in externalReferences)
      {
         ExternalFileReference extRef = transData.GetLastSavedReferenceData(refId);

         if (extRef.ExternalFileReferenceType == ExternalFileReferenceType.RevitLink)
         {
            // we do not want to change neither the path nor the path-type
            // we only want the links to be unloaded (shouldLoad = false)
            transData.SetDesiredReferenceData(refId, extRef.GetPath(), extRef.PathType, false);
         }
      }

      // make sure the IsTransmitted property is set 
      transData.IsTransmitted = true;

      // modified transmission data must be saved back to the model
      TransmissionData.WriteTransmissionData(location, transData);
   }
   else
   {
      Autodesk.Revit.UI.TaskDialog.Show("Unload Links", "The document does not have any transmission data");
   }
}
See Also