Configure data import
The configuration information that is required for importing data is contained in the Data Import (Import) table and the Import Source File (ImportFile) table.
To configure data import, do the following:
- Use the
Import.ModeCode
column to specify whether to create or update data during import. If you are using early bound types, you can use theImportModeCode
enumeration. For a list of the ModeCode values, see the choice values for this table. To view the metadata for your organization, install the Metadata Browser solution described in Browse table definitions in your environment. You can also browse the reference documentation for tables in the Dataverse table/entity reference. - Use the
ImportFile.FileTypeCode
column to specify the type of the import file. If you are using early bound types, you can use theImportFileType
enumeration. For a list of the FileTypeCode values, see the choice values for this table. - Use the
ImportFile.DataDelimiterCode
column to specify the single character data delimiter in the import file. If you are using early bound types, you can use theImportDataDelimiter
enumeration. For a list of the ImportDataDelimiter values, see the choice values for this table. - Use the
ImportFile.FieldDelimiterCode
column to specify the single character column delimiter in the import file. If you are using early bound types, you can use theImportFieldDelimiter
enumeration. For a list of the FieldDelimiterCode values, see the choice values for this table. - Set
ImportFile.IsFirstRowHeader
totrue
to indicate that the first row in the source file contains column headings or tofalse
to indicate that the first row contains actual data. If set tofalse
, default column headings are generated. - Set
ImportFile.ImportId
to the ID of the import (data import) that the import file is associated with. - Set
ImportFile.ImportMapId
to the ID of the associated import map (data map). - Set
ImportFile.EnableDuplicateDetection
totrue
to enable duplicate detection during data import. - Read the content of the source file into the
ImportFile.Content
.
Important
We do not recommend updating records by using data import programmatically. To update, use the data export and import capabilities of the Microsoft Dataverse Web application. Use Export to Excel to export records to an XML Spreadsheet 2003 (.xml) file. This is the only valid source file type for the Update mode. Re-importing data from the XML Spreadsheet 2003 (.xml) source file ensures that the data integrity in Dataverse is maintained. To import updated data, use the Dataverse Import Data Wizard. For more information about the Import Data Wizard, see Dataverse Help.
See Also
Import data
Blog Post: How to Import attachments programmatically
Prepare source files for import
Create data maps for import
Add transformation mappings for import
Run data import
Data import tables
Sample: Export and import a data map
Sample: Import data using complex data map