Document File Manager (.NET)

The Document File Manager API exposes methods for downloading native, image, and produced image files associated with documents in Relativity. You can download a file by specifying its GUID, or you can download a native file by specifying the Artifact ID of the document associated with it. The Document File Manager API also supports retrieving file information, such as GUID, name, type, size, and others.

Sample use cases for the Document File Manager API include the implementing the following functionality:

  • A custom agent that downloads native audio files, transcribes them, and writes the text back to Relativity.
  • A custom page that displays the names, sizes, and types for a subset of documents.

You can also use the Document File Manager API through REST. For more information, see Document File Manager (REST).

The Relativity.ObjectModel.SDK contains this API. For compatibility and package installation instructions, see Download the SDKs and NuGet packages.

Fundamentals for the Document File Manager API

Review the following information to learn about the methods, classes, and enumerations used by the Document File Manager API.

Retrieve document file information

You can retrieve information about the files associated with a document, including the including their file names, identifier, order, and others.

Note: To retrieve the file information for a document, you must have permissions to view it in the workspace. Additionally, you must have access permissions to view a production for its associated files to be included in the results.

The following code sample illustrates how to pass the Artifact IDs of a workspace and Document object to the GetFileInfoAsync(). The method returns a list of DocumentFile objects, and the total count is written to the console.

Download files

You can download a native, image, or produced image file by specifying its GUID in a call to the DownloadFileAsync() method. To obtain the GUID of a file for download, use the GetFileInfoAsync() method.

The response contains these properties with the following settings for HTTP headers:

  • ContentType - the extension of the file determines the value of this header.
  • ContentDisposition - the name of the file as defined within Relativity determines the filename in attachment; filename=. See Download a file by GUID

Note: For native and image files, you must have rights to the document in the workspace. For produced image files, you must have rights to both the document and the production that includes the produced images.

Download a file by GUID

You can download a native, image, or produced image file by specifying its GUID in a call to the DownloadFileAsync() method. To obtain the GUID of a file for download, use the GetFileInfoAsync() method. See Retrieve document file information.

The following code sample illustrates how to pass the Artifact ID of a workspace and a GUID for a file to the DownloadFileAsync() method. This method returns a stream containing the file. It saves the file to disk using the file name specified in the ContentDisposition header.

Download a native file by Document Artifact ID

You can download a native file by making a call to the DownloadNativeFileAsync() method and specifying the Artifact ID of the document associated with it. This convenience method functions similarly to calling the DownloadFile endpoint with the GUID for a native file, except that you specify the Artifact ID of a Document object.