Export job

The following page illustrates how to complete an export job for exporting native files from a folder.

On GitHub, you can find can comprehensive samples illustrating how to export native documents, images, objects, and productions. For additional code samples, see the Export API samples repository.

Create an export job configuration

The following code sample illustrates how to configure an export job.

Create an export job

The following code sample illustrates how to create an export job entity in particular workspace. Job is defined by its unique Id generated by user and provided in the request.

Copy
using Relativity.Export.V1.IExportJobManager jobManager = serviceFactory.CreateProxy<Relativity.Export.V1.IExportJobManager>();

var validationResult = await jobManager.CreateAsync(
    workspaceID,
    jobID,
    jobSettings,
    applicationName,
    correlationID);

Start an export job

The following code sample illustrates how to start an export job which enables the process that schedules export data from workspace based on the configuration assigned in previous sample.

Copy
// Start export job
var startResponse = await jobManager.StartAsync(workspaceID, jobID);

// Check for errors that occured during job start
if (!string.IsNullOrEmpty(startResponse.ErrorMessage))
{
    _logger.LogError($"<{startResponse.ErrorCode}> {startResponse.ErrorMessage}");
    // ...
}

Check export job status

The following code sample illustrates how to check the status of the export job, it will indicate whenever it failed, was completed, or is still running.

Copy
do
{
    var status = await jobManager.GetAsync(workspaceID, jobID);
    Console.WriteLine($"Job status: {status.Value.JobStatus}");
} while (jobStatus?.Value.JobStatus is not ExportStatus.Completed
    and not ExportStatus.CompletedWithErrors
    and not ExportStatus.Failed
    and not ExportStatus.Cancelled);

Export Job States

The following table describes the export job states.

Value State Description
0 New Export job created but not started yet.
1 Scheduled Export job scheduled and waiting for an agent.
2 Running Job executing, export of data is currently in progress.
3 Completed Export job completed. All records processed without errors.
4 CompletedWithErrors Export job completed with some errors. All records processed but one or more item level errors occurred.
5 Failed Export job failed with a fatal error. Not all records were processed.
6 Cancelled Job cancelled by user.
7 Transferring Export from Relativity to Transfer Service location completed. The transfer job is in progress, and export results are syncing to the destination location.