File Field Manager (.NET)

The File Field Manager API exposes a service for uploading and downloading files linked to file fields. For uploads, the overloaded UploadAsync() method supports the use of progress indicators and cancellation tokens.

As a sample use case, you might leverage this service to create a custom page with links for downloading files from Relativity.

You can also use File Field Manager API through REST. However, this service doesn't support cancellation tokens or progress indicators. For more information, see File Field Manager (REST).

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

File Field Manager API fundamentals

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

Sample workflow for file fields

The sample workflow outlines how you might use the Object Manager API in conjunction to the File Field Manager API to add files to Relativity:

  1. Load a sample file from disk into a Kepler stream.
  2. Upload a file as the value for the File field. Use the File Field Manager API to upload this file.
  3. Use the Object Manager API to update the object's File Field value.

After you upload a file to Relativity via the File Field Manager API, it is temporarily stored in the workspace's default file location until the RDO with the File field is saved. If the RDO with the File field and associated file are not saved, the server deletes it after about twenty-four hours based on the FileUploadExpirationHours instance setting.

Downloading files from file fields

To download a file from a file field, pass the following arguments to the DownloadAsync() method:

  • workspaceID - the Artifact ID of the workspace that contains the file field.

    Note: Set the {workspaceId} to -1 to indicate the admin-level context.

  • fileRequest - an object that contains the data used to retrieve the file to be streamed.

The DownloadAsync() method returns an IKeplerStream that contains the content of the file.

Uploading files to file fields

To upload a file to a file field, pass the following arguments to the UploadAsync() method:

  • workspaceID - the Artifact ID of the workspace that contains the file field.

    Note: Set the {workspaceId} to -1 to indicate the admin-level context.

  • fileRequest - a request that contains the data used to retrieve the file to be streamed.
  • file - a stream representing the content of the file.

Note: You can also pass an optional progress indicator, or a progress indicator and a cancellation token to the UploadAsync() method.

The UploadAsync() method returns a FileResponse object that contains the name and GUID for the uploaded file.