Configuring Data Import

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Find the latest SDK documentation: CRM 2015 SDK

The configuration information that is required for running data import is contained in the import (data import) and import file entities.

The import entity contains status and ownership information for an import job. It specifies the operation mode, such as import or migration, and whether the data is created or updated during import.

Note   Data migration does not support updating of data.

Use the following import data (import) entity properties to configure data import:

  • Set the import.modecode property to ImportModeCode.Create or ImportModeCode.Update values of the ImportModeCode enumeration to create or update data during import.
  • Set the import.isimport property to true to indicate that the operation is data import.

The import file entity represents a source file that is used in data import or data migration. It contains the name of the parse table that is associated with the import file. It also contains the unique identifiers of associated import map (data map) and import (data import).

Set the following import file entity properties to configure data import:

  • Set the importfile.usesystemmap property to true or false. If you specify true, an auto-mapping is used. For the auto-mapping to work properly, the column names in the source file have to be identical to the display names of the Microsoft Dynamics CRM entity attributes. If you specify false, a specified data map is used.
  • Set the importfile.filetypecode property to one of the values specified in the ImportFileType enumeration. This property is only available in Microsoft Dynamics CRM Online.
  • For the CSV-formatted source files, set the importfile.datadelimitercode property to one of the values specified in the ImportDataDelimiter enumeration.
  • For the CSV-formatted source files, set the importfile.fielddelimitercode property to one of the values specified in the ImportFieldDelimiter enumeration.
  • For the CSV-formatted source files, set the importfile.isfirstrowheader property to true to indicate that the first row in the source file contains column headings or to false to indicate that the first row contains actual data. If false, default column headings are generated.
  • Set the importfile.importid property to the unique identifier of the import (data import) that the import file is associated with.
  • Set the importfile.importmapid property to the unique identifier of the associated import map (data map).
  • Set the importfile.enableduplicatedetection property to true to enable duplicate detection during data import.
  • Read the contents of the comma-separated values (CSV) source file into the importfile.content property.

Running Data Import in Update Mode

Use the following setting for the update operation:

  • Set the import.modecode property to the ImportModeCode.Update value of the ImportModeCode enumeration.
  • Add a column in the CSV source file that contains the unique identifiers of the entity instances that are being updated.
  • Map the source file column that contains unique identifies to the primary key attribute of the entity instance, such as accountid or contactid. The data that is contained in the columns that are mapped to the primary key attributes is not imported.
  • Set the columnmapping.processcode property to the ImportProcessCode.Ignore value of the ImportProcessCode enumeration for the columns that you do not want to update.

See Also

Other Resources

© 2010 Microsoft Corporation. All rights reserved.