Import Service API builders
Builders provided in the Relativity.Import.Models.SDK package help create settings for import 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 import process.
ImportDocumentsSettingsBuilder
The following code sample illustrates how to use the ImportDocumentsSettingsbuilder to create ImportDocumentSettings. For more information, see Import documents.
C#
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Example of using ImportDocumentSettingsBuilder to create ImportDocumentSettings.
ImportDocumentSettingsBuilder.Create()
.WithOverlayMode(x => x
.WithKeyField(overlayKeyField)
.WithMultiFieldOverlayBehaviour(MultiFieldOverlayBehaviour.MergeAll))
.WithNatives(x => x
.WithFilePathDefinedInColumn(filePathColumnIndex)
.WithFileNameDefinedInColumn(fileNameColumnIndex))
.WithoutImages()
.WithFieldsMapped(x => x
.WithField(controlNumberColumnIndex, "Control Number")
.WithExtractedTextInSeparateFiles(f => f
.WithEncoding("UTF-16")
.WithFileSizeDefinedInColumn(fileSizeColumnIndex))))
.WithFolders(f => f
.WithRootFolderID(rootFolderId, r => r
.WithFolderPathDefinedInColumn(folderPathColumnIndex)));
ImportRdoSettingsBuilder
The following code sample illustrates how to use the ImportRdoSettingsbuilderto create ImportRdoSettings. For more information, see Import data into RDOs.
C# Builder
Copy
1
2
3
4
5
6
7
ImportRdoSettings importSettings = ImportRdoSettingsBuilder.Create()
.WithAppendMode()
.WithFieldsMapped(f => f
.WithField(nameColumnIndex, "Name")
.WithRdo(r => r
.WithArtifactTypeId(domainArtifactTypeID)
.WithoutParentColumnIndex());
DataSourceSettingsBuilder
The following code sample illustrates how to use the DataSourceSettingsBuilder to create DataSourceSettings.
C#
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Example of using DataSourceSettingsBuilder to create DataSourceSettings.
DataSourceSettings dataSourceSettings = DataSourceSettingsBuilder.Create()
.ForLoadFile(loadFile01Path)
.WithDelimiters(d => d
.WithColumnDelimiters('|')
.WithQuoteDelimiter('^')
.WithNewLineDelimiter('#')
.WithNestedValueDelimiter('&')
.WithMultiValueDelimiter('$'))
.WithFirstLineContainingHeaders()
.WithEndOfLineForWindows()
.WithStartFromBeginning()
.WithDefaultEncoding()
.WithDefaultCultureInfo();