CRM Data Import Tool

In Microsoft Dynamics CRM 4.0 it is  possible to export the MSCRM data, modify and re-import data using a tool called MSCRM Import. There are two ways to use this tool. You can edit the records of MSCRM views in the MSCRM Update tool and submit them back to MSCRM. Or you can export the data of any MSCRM view to CSV file, which can be later imported back into MSCRM to update the records. The complete code for the tool is provided here for the avid developers who want to develop solutions currently beyond the scope of this tool. The sample code included uses standard MSCRM SDK calls to achieve this functionality.

The MSCRM Import tool can be downloaded from Follow the instructions in Readme.Txt for installation.

After extracting the files, launch Export.exe in the Release directory. Provide the MSCRM credential using this screen:


Select the entity from the entity drop down box; this will populate system views and user saved views in the views drop down box for the selected entity.


On selecting the desired view and clicking Show Records, all the MSCRM records corresponding to the selected view will be available in the Grid.


Update Records in MSCRM: The data shown in the grid is editable. Update the records in the grid and then click Update Records in MSCRM button. An import job is submitted to MSCRM. Only the modified records will be updated in MSCRM. The modified records are highlighted with Red background as shown in figure below.


Monitor the progress of the import job in MSCRM by viewing the Workplace->Imports section.


Export Records to CSV: Data shown in the Grid can be saved in CSV format by clicking on Export Records to CSV. Select field delimiter (Character used to separate columns of data.) and data delimiter (The character used to surround data that includes the field delimiter. For example, if the field delimiter is a comma, and the data delimiter is quotation marks, one column in a file could contain "Redmond, WA" and still be treated as a single column).

The records in saved CSV file can be edited offline and can be re-imported using the MSCRM Import functionality. MSCRM Import tool will automatically detect that the records are valid for update of existing records.


Steps for Importing the CSV file for update in CRM Web UI:

Launch MSCRM and On the Tools menu, click Import Data.


Specify the CSV file that was exported above. Make sure that on the Select the Record Type and Map screen, the Enrich data by updating records rather than creating new records check box is selected (by default it is selected). If you clear the Enrich data by updating records rather than creating new records check box, the records will not be updated.

Note: A record will not be updated if it has been changed in Microsoft Dynamics CRM after it was exported.


In the Map Source Data to Microsoft Dynamics CRM section you will always see at least one Ignored column warning for the Modified On column. This column is required for enriching data, but is not imported, so ignore the warning.

Click Next, and then click Next again. Rename the import job if needed, change the notification options if needed, and then click Import.

Code Flow Details

We begin with connecting to CRM service and downloading all the entities and its metadata.

//Metadata Service Object

crmMetadataService = new MetadataService();

crmMetadataService.Url = m_ServerURL + "/mscrmservices/2007/MetadataService.asmx";

crmMetadataService.Credentials = new System.Net.NetworkCredential(m_User, m_Pass, m_Domain);

Microsoft.Crm.Sdk.CrmAuthenticationToken token = new Microsoft.Crm.Sdk.CrmAuthenticationToken();

//Authentication type to AD for On-Premise users

token.AuthenticationType = 0 ;

//m_orgname – Organization name of the user

token.OrganizationName = m_orgname;

crmMetadataService.CrmAuthenticationTokenValue = token;

// crmMetadataService.UnsafeAuthenticatedConnectionSharing = true;

//Crm Service Object

_CrmService = new CrmService();

//m_serverURL like http://<servername>

_CrmService.Url = m_ServerURL + "/mscrmservices/2007/CrmService.asmx";

_CrmService.Credentials = new System.Net.NetworkCredential(m_User, m_Pass, m_Domain);

_CrmService.CrmAuthenticationTokenValue = token;

//_CrmService.UseDefaultCredentials = true;

// _CrmService.UnsafeAuthenticatedConnectionSharing = true;

WhoAmIRequest userRequest = new WhoAmIRequest();


// Retrieving all the entities

RetrieveAllEntitiesRequest crmMetadataRequest = new RetrieveAllEntitiesRequest();

crmMetadataRequest.MetadataItems = MetadataItems.IncludeAttributes;

RetrieveAllEntitiesResponse crmMetadataResponse = (RetrieveAllEntitiesResponse)crmMetadataService.Execute((MetadataServiceRequest)crmMetadataRequest);

Once we have the list of all the entities, we load all the system and user views for each entities that are valid for import.

/// <summary>

/// This method is used to retrive all the system default views associated with given entity

/// </summary>

public BusinessEntityCollection SystemViewCollection(int objectTypeCode)


QueryExpression systemQuery = new QueryExpression();

systemQuery.EntityName = EntityName.savedquery.ToString();

ColumnSet systemQueryCols = new ColumnSet();

systemQueryCols.AddColumns(new string[] { "name", "savedqueryid", "fetchxml", "layoutxml" });

systemQuery.ColumnSet = systemQueryCols;

ConditionExpression systemQueryCondition = new ConditionExpression();

systemQueryCondition.AttributeName = "returnedtypecode";

systemQueryCondition.Operator = ConditionOperator.Equal;

systemQueryCondition.Values = new Object[] { objectTypeCode };

ConditionExpression systemQueryCondition1 = new ConditionExpression();

systemQueryCondition1.AttributeName = "querytype";

systemQueryCondition1.Operator = ConditionOperator.Equal;

systemQueryCondition1.Values = new object[] { 0 };

ConditionExpression systemQueryCondition2 = new ConditionExpression();

systemQueryCondition2.AttributeName = "fetchxml";

systemQueryCondition2.Operator = ConditionOperator.NotNull;

FilterExpression feSystemQuery = new FilterExpression();

feSystemQuery.FilterOperator = LogicalOperator.And;




systemQuery.Criteria = feSystemQuery;

BusinessEntityCollection responseSystemquery = _CrmService.RetrieveMultiple(systemQuery);

return responseSystemquery;


Similarly we fetch the user views associated with any entity in method UserViewCollection.

The System and User views of the selected entities are shown in the selection box. When user selects a view and clicks the “Show Records” button, we retrieve all the columns of that particular view and show to the user in the data grid.

resultTable = Exh.ExecuteQuery(lstSavedQuerySelectedItem.SavedQueryXml, colsName);

In addition to the columns defined in the saved view, we also get the primary key and ‘last modified’ fields for the records. Having these two columns is necessary for preparing the data that we can re-import to update the records.

The user can modify the records in the data grid and then click the button “Update Records in MSCRM”. This internally constructs a CSV file with modified records contents and submits an import job to the MSCRM service.

changedCSV = Exh.ExportCsvString(cmbfield.SelectedItem.ToString().Trim(), cmbdata.SelectedItem.ToString().Trim(), changedt);

Exh.importUpdatetoCRM(changedCSV, cmbdata.SelectedItem.ToString().Trim(), cmbfield.SelectedItem.ToString().Trim());

To submit this CSV to import job following SDK calls needs to be made:

Obtain an Importid from CRM System:

import imp = new import();

importid = _CrmService.Create(imp);

l1.Value = importid;

Create an import file Business Entity with the obtained importId:

importfile impf = new importfile();

impf.importid = l1;

importfileid = _CrmService.Create(impf);

With this importid and first create ParseImportRequest:

ParseImportRequest request = new ParseImportRequest();

request.ImportId = importId;

ParseImportResponse response = null;

response = (ParseImportResponse)_CrmService.Execute(request);

Then create TransformImportRequest:

TransformImportRequest tranreq = new TransformImportRequest();

tranreq.ImportId = importId;

TransformImportResponse tranresp = null;

tranresp = (TransformImportResponse)_CrmService.Execute(tranreq);

Finally create ImportRecordsImportRequest:

ImportRecordsImportRequest impreq = new ImportRecordsImportRequest();

impreq.ImportId = importId;

ImportRecordsImportResponse impresp = null

impresp = (ImportRecordsImportResponse)_CrmService.Execute(impreq);

This submits the import job to MSCRM. You can go to the MSCRM Workplace->Imports section and monitor the progress of the job.

Similarly, if you export the records to CSV, you can create a CSV file and save the data grid view into the CSV file. It is important to have Primary Key as the first column. If this is present, the CRM import UI automatically recognizes that the given file is for updating the records. During import of CSV file, the user needs to make sure that on the Select the Record Type and Map screen, the Enrich data by updating records rather than creating new records check box is selected (it is selected if you will use the CSV that you get from this tool ). This is due to the presence of primary Key column of the records as the first column in the CSV file. If this checkbox is not selected, the records will not be updated.

The main advantage of the tool is that if the data is modified and updated in MSCRM with this tool (by clicking Update Records in MSCRM button), only the records that have been modified are submitted. This avoids unnecessary triggering of workflows related to unmodified records in the view. On the other hand if you export to the CSV file, modify few records and then import back using MSCRM import interface, it even imports the rows that are not modified. This is because there is no way for MSCRM to know which records have been changed. This triggers unnecessary Workflow associated with these records.

This gives you a complete flow of how you can export the records from MSCRM, modify them and re-import them back for update.


Veeran Bansal

Adithya Vishwanath

Arun Kumar

Comments (54)

Cancel reply

  1. Ananth says:

    It is very informative. Thanks for the blog.

  2. For CRM 4.0, our Data Management Team introduced several APIs that allow you to bulk edit records in

  3. For CRM 4.0, our Data Management Team introduced several APIs that allow you to bulk edit records in

  4. Some of you may have been frustrated that before the launch of Microsoft Dynamics CRM 4.0, there were

  5. Some of you may have been frustrated that before the launch of Microsoft Dynamics CRM 4.0, there were

  6. Jerry says:

    Can you use the tool to update a lookup field? ie – a contact’s parent account, in the grid view?

  7. Arun Kumar says:

    Yes you can as long as the new parent account already exists. The tool just submits the update to CRM. The success and failure is handled by CRM, the tool has no role in it.

    >Can you use the tool to update a lookup field? ie – a contact’s parent account, in the grid view?

  8. patric says:


    I am trying to import data into CRM 4.0 using data management tool.

    1. I have created a new mapping.

    2. The data are correctely mapped into CRM

    3. I tried importing data using import data from tools.

    4. I am able to complete the wizard process correctly

    5. I do see the job created under the imports.

    6. I do see the status "InProcess"

    7. It is been 2 days already, I do not see the data been imported into my CRM database.

    Please what could be wrong.

    How can I get them instantly imported into my entity.

    Please advice


  9. Peter says:


    I have the same problem as patric:

    1. I have created a new mapping.

    2. The data are correctely mapped into CRM

    3. I tried importing data using import data from tools.

    4. I am able to complete the wizard process correctly

    5. I do see the job created under the imports.

    6. I do see the status "InProcess"

    7. It is been 2 days already, I do not see the data been imported into my CRM database.

    Just that I noticed that there is an error in the SQL Agent, the user (which is an Administrator) cannot login and so the job fails.

    How could this problem be solved?

  10. Let me guess, either you are looking to learn ‘how to import data’ or you are stuck with some issues

  11. HArry says:

    Hi all,

    Does anyone know why this the Codeplex website is no longer available?

    Is there somewhere else I can get this tool?



  12. 365blog says:

    Hmm… we can still access the tool at the link provided. Do you still have that problem?

  13. Geoff Ables says:

    &lt;p&gt;There are many options for migrating data into Microsoft CRM and/or integrate data with other applications.&amp;#160; So many options, in fact, that it can be quite confusing.&amp;#160; This …

  14. &lt;p&gt;With Microsoft Dynamics CRM 4.0 there are many so many options for migrating, integrating and bulk updating data that it can be quite confusing.&amp;#160; This entry presents many of the opti …

  15. Chris Harris says:

    Now that CRM Live is active, has anyone tried to use this tool to import data?  I made an attempt and can’t seem to get past the credentials.  Hope someone their know what the program is asking for in a user name.  Windows Live ID?  CRM User name?  Inquiring minds want to know 😉

  16. Tara Vitori says:

    There is really cheap tool from called EBAX that lets you update CRM data directly from Excel. It is like a dynamic worksheet, but it has an Update button to push data back to the server. We were able to do mass updates from inside Excel with just a copy/paste of data from other sources.

  17. Is there any way to use this tool with MS Dynamics CRM Online (aka Live)? I tried but it did not work out.

  18. Rich Renfrow says:

    We used the Bulk Export tool from CodePlex to export Users from an org with the intention to use Data Import Wizard to load them to a different org., but can’t seem to find the Users entity when importing.  Can Users be imported much like Accounts or Contacts?  We don’t see it as an option.

  19. Mathew says:

    I also would like to use this with CRM Online, did anyone get that working? Is it possible? If so, what do you use to authenticate (Windows Live ID? Which domain? etc.)?

  20. jeetu says:

    I’m using MSCRM 4.0, but I’m unable to execute the Plug-in in it. I’m getting an error "The request failed with HTTP status 401: Unauthorized" when I’m creating a new Account in MS CRM application. Please help me if anyone have any idea about this error or issue.

    Thanks in advance.

  21. joanne says:

    When I click on ‘Show Records’ for Contacts, I get this error:

    ‘Unhandled exception has occurred in your application….Method not found: Single Microsoft.Crm.Sdk.CrmFloat.get_Value()’

    Anyone encountered this same error too?

  22. Alex says:

    Enrich data by updating records rather than creating new records

    This checkbox isn’t there for me…?

    I am a system administrator.

  23. jayesh john says:

    hi to all,

    A simple question..

    if the user knows which record and what to be updated ,what is the use of the tool.

    I mean the user can directly access MSCRM, update that record.

    Is there any way i can update the existing record in CRM if i configure  duplicate detection and import the record using excel file?

    Thanx in advance

  24. Josh - MS CRM Support says:

    This will not work for CRM Online.  If you look into the code you can see:

    //Authentication type to AD for On-Premise users

    There is no authentication method to connect to Windows Live and process authentication.

  25. Steve says:

    Hey Joanne I get the exact same error as you for every entity…have you found out why yet?

  26. H_in_the_sky says:

    Me too! I copied the dlls as per the instructions to the release dir, and get the same error as per Joanne’s post. What are we missing?

  27. Rohit Mishra says:

    i have one related entity in which i use account as a lookup and one custom entity projects also as a lookup.i have sucessfully

    import data into account entity and project entity. now i m trying to import data into related entity but it is continue erroring like "the lookup refrence can not be resolved".

    please Reply me it’s urgent.


  28. Camille says:

    I’m jumping on the bandwagon of getting the:

    ‘Unhandled exception has occurred in your application….Method not found: Single Microsoft.Crm.Sdk.CrmFloat.get_Value()’

    error. Hoping someone will still post a response. This tool is a bit old (February) – maybe MS changed something so it won’t work anymore??

  29. Darrin says:

    I’m posting in regards to the "Single Microsoft.Crm.Sdk.CrmFloat.get_Value()" error. It’s probably an issue with the dll as there has been several revisions of the SDK released.

    You can resolve the issue by building the project in Visual Studio:

    Rebuild the project


    1. Download the MSCRM 4.0 SDK using the link

    2. Copy Microsoft.Crm.Sdk.dll and Microsoft.Crm.SdkTypeProxy.dll in the root folder of the project. Update project references to include the above two dlls.

    3. Build Export.csproj. If you get errors about unreachable code or unused variables you can ignore them.

    4. Copying the files out of the binRelease folder that is in the Project directory.

    5. Double click the Export.exe file and have fun!

  30. Sabine says:


    I realised that this tool can’t update the lookup values. Why? Is there any way to fix this?

  31. GT says:


    Step 2… Update project references?  Where do you do that?

    Step 3… How do you build the project?

  32. John says:

    Is it possible to update values in lookup fields?

  33. Wouter says:

    I’ve just posted an article on my site about enabling the ‘re-import’ button on the export page in CRM. This is an unsupported way of doing things, so you’re on your own on this one. It baiscally enables the export of the guid and last modified on date. During import, the guid is read and the option to update the records is enabled.

    I don’t know how good it works in your case.

  34. crmusr says:

    How do you import csv file into  crm ?

    The Help points to the word doc which points

    to the regular import wizard of crm which is

    no use with large files

  35. Wolfgang says:

    Great Work,

    but I get an error, when I want to show records. I copied the two dlls in the release folder as discribed, but get these error: any ideas??

    System.MissingMethodException: Methode nicht gefunden: "Single Microsoft.Crm.Sdk.CrmFloat.get_Value()".

      bei Export.ExpHelper.ExecuteQuery(String fetchXml, ArrayList colsName)

      bei Export.Form1.btnExecuteQuery_Click(Object sender, EventArgs e)

      bei System.Windows.Forms.Control.OnClick(EventArgs e)

      bei System.Windows.Forms.Button.OnClick(EventArgs e)

      bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)

      bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

      bei System.Windows.Forms.Control.WndProc(Message& m)

      bei System.Windows.Forms.ButtonBase.WndProc(Message& m)

      bei System.Windows.Forms.Button.WndProc(Message& m)

      bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

      bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

      bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    ************** Geladene Assemblys **************



       Win32-Version: 2.0.50727.3053 (netfxsp.050727-3000).

       CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll.





       CodeBase: file:///C:/Dokumente%20und%20Einstellungen/wpolk/Eigene%20Dateien/Visual%20Studio%202008/Projects/CRM%204.0/MSCRMImport/Release/Export.exe.




       Win32-Version: 2.0.50727.3053 (netfxsp.050727-3000).

       CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/




       Win32-Version: 2.0.50727.3053 (netfxsp.050727-3000).

       CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/




       Win32-Version: 2.0.50727.3053 (netfxsp.050727-3000).

       CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/




       Win32-Version: 4.0.7333.3.

       CodeBase: file:///C:/Dokumente%20und%20Einstellungen/wpolk/Eigene%20Dateien/Visual%20Studio%202008/Projects/CRM%204.0/MSCRMImport/Release/Microsoft.Crm.Sdk.DLL.




       Win32-Version: 2.0.50727.3053 (netfxsp.050727-3000).

       CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll.




       Win32-Version: 4.0.7333.3.

       CodeBase: file:///C:/Dokumente%20und%20Einstellungen/wpolk/Eigene%20Dateien/Visual%20Studio%202008/Projects/CRM%204.0/MSCRMImport/Release/Microsoft.Crm.SdkTypeProxy.DLL.




       Win32-Version: 2.0.50727.3053 (netfxsp.050727-3000).

       CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Web.Services/




       Win32-Version: 2.0.50727.3053 (netfxsp.050727-3000).

       CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/




       Win32-Version: 2.0.50727.3053 (netfxsp.050727-3000).

       CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/




       Win32-Version: 2.0.50727.3053 (netfxsp.050727-3000).

       CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/




       Win32-Version: 2.0.50727.3053 (netfxsp.050727-3000).

       CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/




       Win32-Version: 2.0.50727.3053 (netfxsp.050727-3000).

       CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms.resources/




       Win32-Version: 2.0.50727.3053 (netfxsp.050727-3000).

       CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/


  36. On Codeplex there is a tool for Microsoft Dynamics CRM On Premise&#160; that allows you to modify records

  37. John says:

    The Codeplex binary (.exe) that’s provided has some bugs.

    If you have Visual C Sharp Studio 2008 and can re add two references (update the .dll files with the CRM SDK dll files) and comment out one line of code on line 310 …

    Then this tool works pretty well.

    CRM 4.0 SDK

    MS VS 2008 C# express

  38. Yaniv says:

    A walkthrough on using the CRM Data Import Tool although it has been removed    

  39. Richard says:

    This works great some of my entities but not all. It works perfect on the entity with 24 records but wont update any record on my entities with 49000 or 79000 records. I just get one of the following errors:

    "Import has encountered an error and have been canceled. Your system has been restored to its original state. At least one attribute mapping has its IsSystem attibute set to 1. Import cannot create system attribute mappings" – even though I am only updating one custom text attribute!

    or with another entity:

    "The specified record cannot be found. The data for this record might have been incorrectly entered.." I’m sure this is not the case because I exported the record GUIDs from CRM to CSV in the first place!

    I suppose no-one has any answers for this and I’m just going to have to bite the bullet and order c360 import manager 🙁

    Many Thanks

  40. Nfauerbach says:

    When I go to re import data from a csv file that has been exported and enriched, I get a different screen in the Import Data Wizard than is shown in the help above. I do not get the radio button asking if this is data that is being reimported. I am running CRM 4.0.7333.3.

  41. Paul Evison says:

    "Note: A record will not be updated if it has been changed in Microsoft Dynamics CRM after it was exported. "

    How do you get round this? It’s not possible for me to make the changes I need to the data and upload it again in time.

    It fails even if I change the modified on date to now, on the CSV.

  42. GURAM says:

    Can you tell me how can i update picklist values via your tool ?

  43. Alex says:

    Hi together,

    nice tool so far, but I also have the often mentioned problem with updating lookup-fields!

    I’ve figured out that the date/time of change of the entity within the export-file is not set to the current date. Instead it’s the date/time of the last change done to the data.

    So CRM will tell me that the data in DB is newer (in facts it’s equal) than the data I try to import and will not process them 🙁

    Can anybody confirm my assumption and tell me how to best fix it?

    Thanks ahead!

  44. kong says:

    This tool is worked fine for update import in CRM 4.0

  45. Fred says:

    I am trying to enrich data in our crm (on premise, 4.0 (4.0.7333.2644) with roll up 9 and I do not get the radio button to Enrich data.  I do set the import I skip to match Account numbers and to skip the modified on, but when I run I bet the error that "A record with these values already exists, A duplicate record cannot be created.  Select one or more unique values and try again>"

    Any help?

    Thank you.

  46. Roberto says:

    Very interesting. What about importing from Excel files, is there a wizard in CRM 4.0?

  47. DiamFC says:

    I have not this check-box in CRM 4.0 on-line. WHY???

  48. JP says:

    From the web import data wizard there is no enriching check box option on crm 4.0 update 12.

  49. Jan Tenenberg says:

    Hi, we seem to have trouble connecting non-administrator users using this code. It fails with a Non-Authenticated 401 message. It connects and runs very nicely for all admin users but not for anybody else.

    Do you have ideas why this would be the case?


  50. Neel Rao says:

    How to access records from savedquery(views) CRM ?

Skip to main content