locked
file upload RRS feed

  • Question

  •  

    Hi All,

     

    can I get a file uploaded to access in aspx code to use for data import?

     

    Thanks

    Hassan

    Friday, July 18, 2008 7:09 AM

Answers

  • Yes, this is possible. Here's how I've done this in the past:

     

    - Create an ASPX that prompts for the import file name, import job name (optional), and the user or queue to whom you want to assign the imported records.

     

    - Create a folder that is accessible by the web application. For example, if you're running CRM with NETWORK SERVICE then that account must be able to read files in the import file folder.

     

    - Once the user clicks your Import button, the ASPX reads the file and executes the import code. See the SDK for the article titled "Start an Import Job". That article provides a good code example.

     

    To keep things simple, I suggest using column names in your import file that match the schema name of the attribute for which the data is being imported. By allowing CRM to map data to attributes automatically means that you won't have to create or maintain a custom import map.

     

    After you start the import programmatically, you might consider displaying the import status form so that users can monitor the status of the import job.

     

    If you need to map picklist values to attributes then, in your import files, specify the string version of the picklist item, not the ID. The import process will properly read the string, match it to the picklist attribute, and determine the ID for storage in SQL.

     

    Please post the progress on your design and code and I and others will try to help you along.

     

    -Tim

    Monday, July 21, 2008 3:39 AM

All replies

  • Greetings,

     

    I noticed that no one has yet replied to your question.

     

    When you post a question to the CRM forums, please provide as much information as possible, including the following:

     

    - The version of CRM that you are using.

     

    - A detailed scenario of what you are trying to accomplish.

     

    - Any error messages you are receiving.

     

    - Any code, XML, data samples, etc. to help others understand the details of your question or problem.


    Without that information it's very difficult or impossible to provide accurate responses.

     

    I'm assuming that you are asking about starting an import job through code. If this is what you are asking then you'll find a code example in the SDK (4.0) in the article titled "Start an Import Job".

     

    Please reply with more details and I'll try to help out.

     

    Cheers,

     

    -Tim

     

    Saturday, July 19, 2008 11:50 PM
  • but the problem is can I get data with the help of uploading a file through aspx page, and then pass the contents of the uploaded file to importFile.Content

     

    Thanks

    Hassan

     

    Monday, July 21, 2008 2:02 AM
  • Yes, this is possible. Here's how I've done this in the past:

     

    - Create an ASPX that prompts for the import file name, import job name (optional), and the user or queue to whom you want to assign the imported records.

     

    - Create a folder that is accessible by the web application. For example, if you're running CRM with NETWORK SERVICE then that account must be able to read files in the import file folder.

     

    - Once the user clicks your Import button, the ASPX reads the file and executes the import code. See the SDK for the article titled "Start an Import Job". That article provides a good code example.

     

    To keep things simple, I suggest using column names in your import file that match the schema name of the attribute for which the data is being imported. By allowing CRM to map data to attributes automatically means that you won't have to create or maintain a custom import map.

     

    After you start the import programmatically, you might consider displaying the import status form so that users can monitor the status of the import job.

     

    If you need to map picklist values to attributes then, in your import files, specify the string version of the picklist item, not the ID. The import process will properly read the string, match it to the picklist attribute, and determine the ID for storage in SQL.

     

    Please post the progress on your design and code and I and others will try to help you along.

     

    -Tim

    Monday, July 21, 2008 3:39 AM