Compartilhar via


Configure data import

 

Applies To: Dynamics CRM 2013

The configuration information that is required for importing data is contained in the import (data import) (Import) entity and the import file (ImportFile) entity.

To configure data import, do the following:

  • Use the Import.ModeCode attribute to specify whether to create or update data during import. If you are using early bound types, you can use the ImportModeCode enumeration. For a list of the ModeCode values, see the picklist values for this entity. To view the entity metadata for your organization, install the Metadata Browser solution described in Browse the metadata for your organization. You can also view the metadata for an uncustomized organization in the Excel file called EntityMetadata.xlsx included in the top-level folder of the SDK download.

  • Set Import.IsImport to true.

  • Use the ImportFile.FileTypeCode attribute to specify the type of the import file. If you are using early bound types, you can use the ImportFileType enumeration. For a list of the FileTypeCode values, see the picklist values for this entity. This attribute is only available in Microsoft Dynamics CRM Online.

  • Use the ImportFile.DataDelimiterCode attribute to specify the single character data delimiter in the import file. If you are using early bound types, you can use the ImportDataDelimiter enumeration. For a list of the ImportDataDelimiter values, see the picklist values for this entity.

  • Use the ImportFile.FieldDelimiterCode attribute to specify the single character field delimiter in the import file. If you are using early bound types, you can use the ImportFieldDelimiter enumeration. For a list of the FieldDelimiterCode values, see the picklist values for this entity.

  • Set ImportFile.IsFirstRowHeader 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 set to false, 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 to true 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 Dynamics CRM 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 Microsoft Dynamics CRM is maintained. To import updated data, use the Microsoft Dynamics CRM Import Data Wizard. For more information about the Import Data Wizard, see Microsoft Dynamics CRM Help.

See Also

Import data
Blog Post: How to Import attachments programmatically
Run data import