Export Service API builders
Builders provided in the Relativity.Export.SDK package help create settings for export jobs and data sources in a correct and consistent way. We recommend you prepare these objects in a .NET application. Using the builders in a client application avoids the risk of an incorrect configuration
that may lead to errors during the export process.
As of September 1, 2024, we’ve streamlined our Staging boundaries to more effectively separate staging data from workspace and system data. With this change, you will no longer be able to write to or access data outside of the four defined staging area folders. The four folders that comprise the Staging area are ARM, ProcessingSource, StructuredData, and TenantVM. Folders that were removed include FTA, Temp, Export, and dtSearch, in addition to any other folders that you manually created. Refer to the Staging Area topic and Staging Area FAQ in Community for more details.
Export Builders
The following code samples show how to create export job settings using builders to export native, fulltext, images, and PDF files from a folder.
Although it is possible to use builders in a method chaining manner to create settings, it is less readable and more error prone.
Export source settings
The following code sample contains information about source of data to export.
Copy
1
2
3
4
5
6
// Export source settings
var sourceSettings = ExportSourceSettingsBuilder.Create()
.FromFolder(exportSourceArtifactID: folderID, viewID: viewID)
.WithSubfolders() // include subfolders
.WithCustomStartAtDocumentNumber(1)
.Build();
Export Artifact settings
The following code sample contains information about artifacts to export.
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Artifact settings
var artifactSettings = ExportArtifactSettingsBuilder.Create()
.WithDefaultFileNamePattern()
.WithoutApplyingFileNamePatternToImages()
.ExportImages(settings => settings
.WithImagePrecedenceArtifactIDs(new List<int> { -1 }) // Exports images
.WithTypeOfImage(ImageType.Pdf))
.ExportFullText(settings => settings
.ExportFullTextAsFile()
.WithTextFileEncoding("UTF-8")
.WithPrecedenceFieldsArtifactIDs(fulltextPrecedenceFieldsArtifactIds))
.ExportNative(settings => settings
.WithNativePrecedenceArtifactIDs(new List<int> { -1 })) // Exports native files
.ExportPdf() // Export PDF files
.WithFieldArtifactIDs(new List<int> { 1003676, 1003667 }) // Fields to export
.WithoutExportingMultiChoicesAsNested()
.Build();
Export Subdirectory settings
The following code sample contains information about output format and structure of exported files.
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Subdirectory settings
var subdirectorySettings = SubdirectorySettingsBuilder.Create()
.WithSubdirectoryStartNumber(1)
.WithMaxNumberOfFilesInDirectory(100)
.WithDefaultPrefixes()
.OverridePrefixDefaults(prefixes =>
{
// Optional overrides
prefixes.FullTextSubdirectoryPrefix = "FULLTEXT_";
prefixes.NativeSubdirectoryPrefix = "NATIVE_";
prefixes.ImageSubdirectoryPrefix = "IMAGE_";
prefixes.PdfSubdirectoryPrefix = "PDF_";
})
.WithSubdirectoryDigitPadding(5)
.Build();
// Volume settings
var volumeSettings = VolumeSettingsBuilder.Create()
.WithVolumePrefix("VOL_FOLDER_")
.WithVolumeStartNumber(1)
.WithVolumeMaxSizeInMegabytes(100)
.WithVolumeDigitPadding(5)
.Build();
// Loadfile settings
var loadfileSettings = LoadFileSettingsBuilder.Create()
.WithoutExportingMsAccess()
.WithoutCustomCultureInfo()
.WithLoadFileFormat(LoadFileFormat.CSV)
.WithEncoding("UTF-8")
.WithImageLoadFileFormat(ImageLoadFileFormat.IPRO)
.WithPdfFileFormat(PdfLoadFileFormat.IPRO_FullText)
.WithDelimiterSettings(delimiters =>
delimiters.WithDefaultDelimiters())
.Build();
// Output settings
var outputSettings = ExportOutputSettingsBuilder.Create()
.WithoutArchiveCreation()
.WithDefaultFolderStructure()
.WithDefaultDestinationPath()
.WithSubdirectorySettings(subdirectorySettings)
.WithVolumeSettings(volumeSettings)
.WithLoadFileSettings(loadfileSettings)
.Build();
When using Export.SDK, ensure the destination path adheres to Staging Governance by placing it inside the StructuredData\Export folder.
Export job settings
The following code sample contains the export job settings.
Copy
1
2
3
4
5
6
// Export job settings
var jobSettings = ExportJobSettingsBuilder.Create()
.WithExportSourceSettings(sourceSettings)
.WithExportArtifactSettings(artifactSettings)
.WithExportOutputSettings(outputSettings)
.Build();