How to read XML file and update the data in MS CRM 2011?

Hi Folks,
Can anyone please help me finding some references to read XML files and push the data to MS CRM 2011 preferably by using a console application.
Please let me know if any ways of handling it in simple ways.
Thanks,
Sri

HI,
How to read XML file:
https://social.msdn.microsoft.com/Forums/en-US/5dd7261b-86c4-4ca8-ba87-95196ef3ba50/need-to-display-xml-file-in-textboxes-edit-the-data-and-save-the-new-xml-file?forum=csharpgeneral
How to work with CRM:
ClientCredentials credentials = new ClientCredentials();
credentials.Windows.ClientCredential = new System.Net.NetworkCredential("USER", "Password", "Domain");
Uri uri = new Uri("http://server/Organization/XRMServices/2011/Organization.svc");
OrganizationServiceProxy proxy = new OrganizationServiceProxy(uri, null, credentials, null);
proxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
IOrganizationService service = (IOrganizationService)proxy;
//using "service" you can create, update and retrieve entities.
More information here about service functions:
https://msdn.microsoft.com/en-us/library/gg328198.aspx

Similar Messages

  • How to Read Xml File and view into Data Grid View?

    hi all
    my Data into Xml file are:
    <Voucher>
    <Header>
    <txtHeaderId>259803</txtHeaderId>
    <txtDate>2015/02/01</txtDate>
    <txtDocNo>20</txtDocNo>
    <txtMemo>This is a Test .</txtMemo>
    </Header>
    <Item>
    <txtItemId>8562803</txtItemId>
    <txtHeaderRef>259803</txtHeaderRef>
    <txtDesc>This is Number 1</txtDesc>
    <txtDebit>350000</txtDebit>
    <txtCredit>0</txtCredit>
    <txtItemId>8562804</txtItemId>
    <txtHeaderRef>259803</txtHeaderRef>
    <txtDesc>This is Number 2</txtDesc>
    <txtDebit>0</txtDebit>
    <txtCredit>350000</txtCredit>
    </Item>
    </Voucher>
    now i have two DataGridViews 
    i want that data from xml file show into the DataGridViews by this codes:
    Private Sub btnReadXmlFile_Click(sender As Object, e As EventArgs) Handles btnReadXmlFile.Click
    Dim Document As XmlReader = New XmlTextReader(txtPath.Text)
    Dim ds As New DataSet
    ds.ReadXml(Document)
    DataGridView1.DataSource = ds.Tables(0)
    End Sub
    but i see this result:
    why i do not see any result into DataGridView2(Item)
    how to solve it ?
    please help me .
    thanks all
    Name of Allah, Most Gracious, Most Merciful and He created the human

    now how to correct it?
    Name of Allah, Most Gracious, Most Merciful and He created the human
    Please be explicit - I'm the only other one in this thread so I assume it's to me, but usually I just ignore the posts when the user isn't specific.
    I don't know what there is to correct. Create a NEW dataset in code, add the two tables, and use the methods that I suggested.
    I'm not a database guy so I can't get real specific. I create my own stuff in classes and use that but, if you're using SQL then there are lots of pro's here that can help you with specifics. I'm sure they'll need to know a lot more about your data, the
    connection, and all that, but the concept should be fairly simple to implement.
    Still lost in code, just at a little higher level.

  • (Urgent help needed) how to read txt file and store the data into 2D-array?

    Hi, I have a GUI which allow to choose file from the file chooser, and when "Read file" button is pressed, I want to show the array data into the textarea.
    The sample data is like this followed:
    -0.0007     -0.0061     0.0006
    -0.0002     0.0203     0.0066
    0     0.2317     0.008
    0.0017     0.5957     0.0008
    0.0024     1.071     0.0029
    0.0439     1.4873     -0.0003
    I want my program to scan through and store these data into 2D array.
    However for some reason, my source code issues errors, and I don't know what's wrong with it, seems to have a problem in StringTokenizer though. Can anybody help me?
    Thanks in advance.
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.StringTokenizer;
    public class FileReduction1 extends JFrame implements ActionListener{
    // GUI features
    private BufferedReader fileInput;
    private JTextArea textArea;
    private JButton openButton, readButton,processButton,saveButton;
    private JTextField textfield;
    private JPanel pnlfile;
    private JPanel buttonpnl;
    private JPanel buttonbar;
    // Other fields
    private File fileName;
    private String[][] data;
    private int numLines;
    public FileReduction1(String s) {
    super(s);
    // Content pane
         Container cp = getContentPane();
         cp.setLayout(new BorderLayout());     
    // Open button Panel
    pnlfile=new JPanel(new BorderLayout());
         textfield=new JTextField();
         openButton = new JButton("Open File");
    openButton.addActionListener(this);
    pnlfile.add(openButton,BorderLayout.WEST);
         pnlfile.add(textfield,BorderLayout.CENTER);
         readButton = new JButton("Read File");
    readButton.addActionListener(this);
         readButton.setEnabled(false);
    pnlfile.add(readButton,BorderLayout.EAST);
         cp.add(pnlfile, BorderLayout.NORTH);
         // Text area     
         textArea = new JTextArea(10, 100);
    cp.add(new JScrollPane(textArea),BorderLayout.CENTER);
    processButton = new JButton("Process");
    //processButton.addActionListener(this);
    saveButton=new JButton("Save into");
    //saveButton.addActionListener(this);
    buttonbar=new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttonpnl=new JPanel(new GridLayout(1,0));
    buttonpnl.add(processButton);
    buttonpnl.add(saveButton);
    buttonbar.add(buttonpnl);
    cp.add(buttonbar,BorderLayout.SOUTH);
    /* ACTION PERFORMED */
    public void actionPerformed(ActionEvent event) {
    if (event.getActionCommand().equals("Open File")) getFileName();
         if (event.getActionCommand().equals("Read File")) readFile();
    /* OPEN THE FILE */
    private void getFileName() {
    // Display file dialog so user can select file to open
         JFileChooser fileChooser = new JFileChooser();
         fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
         int result = fileChooser.showOpenDialog(this);
         // If cancel button selected return
         if (result == JFileChooser.CANCEL_OPTION) return;
    if (result == JFileChooser.APPROVE_OPTION)
         fileName = fileChooser.getSelectedFile();
    textfield.setText(fileName.getName());
         if (checkFileName()) {
         openButton.setEnabled(false);
         readButton.setEnabled(true);
         // Obtain selected file
    /* READ FILE */
    private void readFile() {
    // Disable read button
    readButton.setEnabled(false);
    // Dimension data structure
         getNumberOfLines();
         data = new String[numLines][];
         // Read file
         readTheFile();
         // Output to text area     
         textArea.setText(data[0][0] + "\n");
         for(int index=0;index < data.length;index++)
    for(int j=1;j<data[index].length;j++)
    textArea.append(data[index][j] + "\n");
         // Rnable open button
         openButton.setEnabled(true);
    /* GET NUMBER OF LINES */
    /* Get number of lines in file and prepare data structure. */
    private void getNumberOfLines() {
    int counter = 0;
         // Open the file
         openFile();
         // Loop through file incrementing counter
         try {
         String line = fileInput.readLine();
         while (line != null) {
         counter++;
              System.out.println("(" + counter + ") " + line);
    line = fileInput.readLine();
         numLines = counter;
    closeFile();
         catch(IOException ioException) {
         JOptionPane.showMessageDialog(this,"Error reading File",
                   "Error 5: ",JOptionPane.ERROR_MESSAGE);
         closeFile();
         System.exit(1);
    /* READ FILE */
    private void readTheFile() {
    // Open the file
    int row=0;
    int col=0;
         openFile();
    System.out.println("Read the file");     
         // Loop through file incrementing counter
         try {
    String line = fileInput.readLine();
         while (line != null)
    StringTokenizer st=new StringTokenizer(line);
    while(st.hasMoreTokens())
    data[row][col]=st.nextToken();
    System.out.println(data[row][col]);
    col++;
    row++;
    closeFile();
    catch(IOException ioException) {
         JOptionPane.showMessageDialog(this,"Error reading File",
                   "Error 5: ",JOptionPane.ERROR_MESSAGE);
         closeFile();
         System.exit(1);
    /* CHECK FILE NAME */
    /* Return flase if selected file is a directory, access is denied or is
    not a file name. */
    private boolean checkFileName() {
         if (fileName.exists()) {
         if (fileName.canRead()) {
              if (fileName.isFile()) return(true);
              else JOptionPane.showMessageDialog(null,
                        "ERROR 3: File is a directory");
         else JOptionPane.showMessageDialog(null,
                        "ERROR 2: Access denied");
         else JOptionPane.showMessageDialog(null,
                        "ERROR 1: No such file!");
         // Return
         return(false);
    /* FILE HANDLING UTILITIES */
    /* OPEN FILE */
    private void openFile() {
         try {
         // Open file
         FileReader file = new FileReader(fileName);
         fileInput = new BufferedReader(file);
         catch(IOException ioException) {
         JOptionPane.showMessageDialog(this,"Error Opening File",
                   "Error 4: ",JOptionPane.ERROR_MESSAGE);
    System.out.println("File opened");
    /* CLOSE FILE */
    private void closeFile() {
    if (fileInput != null) {
         try {
              fileInput.close();
         catch (IOException ioException) {
         JOptionPane.showMessageDialog(this,"Error Opening File",
                   "Error 4: ",JOptionPane.ERROR_MESSAGE);
    System.out.println("File closed");
    /* MAIN METHOD */
    /* MAIN METHOD */
    public static void main(String[] args) throws IOException {
         // Create instance of class FileChooser
         FileReduction1 newFile = new FileReduction1("File Reduction Program");
         // Make window vissible
         newFile.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         newFile.setSize(500,400);
    newFile.setVisible(true);
    Java.lang.NullpointException
    at FileReductoin1.readTheFile <FileReduction1.java :172>
    at FileReductoin1.readFile <FileReduction1.java :110>
    at FileReductoin1.actionPerformed <FileReduction1.java :71>
    .

    1) Next time use the CODE tags. this is way too much unreadable crap.
    2) The problem is your String[][] data.... the only place I see you do anything approching initializing it is
    data = new String[numLines][];I think you want to do this..
    data = new String[numLines][3];anyway that's why it's blowing up on the line
    data[row][col]=st.nextToken();

  • Is it possible to have 2 different output config XML files and index the data into 2 endeca apps using the same indexing component ProductCatalogSimpleIndexingAdmin

    Hi ,
    We have a catalog that defines 2 types of products (they have too many different properties), so wanted to keep them on two different MDEX engines and serve the applications requests. Here DB catalog and front end ATG application is same for both the MDEX instances.
    Is it possible to have 2 different output config XML files and index the data into 2 endeca apps using the same indexing component ProductCatalogSimpleIndexingAdmin?
    Thanks
    Dev

    Hi, also have had some problem some monthes ago - I created separete component ProductCatalogSimpleIndexingAdminSecond. After that one of my colleage gave me some advice:
    The creating separate component like ProductCatalogSimpleIndexingAdmin for the second IOC is possible way for resolving your situation. But I afraid that this way will be required creating mane duplicates for already existed components.
    In my opinion the better way is the following:
    starting from AssemblerApplicationConfiguration and ApplicationConfiguration component. It contains details for connecting between ATG and Endeca. Of course you should configure different components for different Endeca Apps.
    After that:
    Find all components that uses AssemblerApplicationConfiguration and ApplicationConfiguration. Customize these components for using one or another  *Configuration component depending on what index works. (many variants released it: the most simple global custom component with flag.)
    Then customize the existed ProductCatalogSimpleIndexingAdmin. Using one or another IOC  and setting the flag in global custom component when index started. You can add some methods into your custom ProductCatalogSimpleIndexingAdmin like:
    Execute baseline index for both IOC (one by one)
    Execute baseline for IOC 1
    Execute baseline for IOC 2.
    Note: you should be afraid about incremental (partial) index in this configuration. But resolving conflicts in incremental index should be done after full implementation these changes.
    Regards

  • How to read XML file and write into another XML file

    Hi all, I am new to JAVAXML.
    My problem is I have to read one XML file and take some Nodes from that and write these nodes into another XML file...
    I solved, how to read XML file
    But I don't know how to Write nodes into another XML.
    Can anyone help in this???
    Thanks in advance..

    This was answered a bit ago. There was a thread called "XML Mergine" that started on Sept 14th. It has a lot of information about what it takes to copy nodes from one XML Document object into another.
    Dave Patterson

  • Code to read xml file  and display that data using sax parser

    Hai
    My problem I have to read a xml file and display the contents of the file on console using sax parser.

    here you go

  • Reading from XML file and updating the table ????

    Hi
    I have package which reads the hier.XML file and does Update inserts into the 5 tables
    i have table called MAIN_tbl with the column cur_date.
    The package kicks if this cur_date is one day less than the hier.XML file DT.
    Currently i m manually checking this date's to make sure the Main_tbl cur_date is n sync with
    hier.XML file DT.
    for example :- hier.xml file DT is "20091020" then main_table cur_date should be 10/19/2009
    in order to kicks of the pakage.
    what i m looking to do ??
    compare the hier.xml DT with the main_table cur_date,
    if cur_date is -1(Preivous day) of hier.xml DT then run hier_pkg(Package)
    if not then update main_table cur_date to -1(previous day) of the hier.xml DATE
    Then later write the above logic to update the main_table in a procedure, and
    then call the package from the procedure.
    below are the top few lines of the hier.XML file which is relevant to the one which we are trying to do
    <?xml version = '1.0'?>
    <HIER_POSTING num ="111" HIER_TYP="CD" DT="20091020" Global="Y">
    FYI : The hier.XML file is located in UNIX space.
    How do i accomplish this. any idea ????
    Thank you so much in advance. For giving a thought on this problem!!!

    Any thought on this guys ???
    Thanks!!

  • How to read xml file and place it into an internal table...

    hello all,
    can any one help me in - how to read xml data file (placed in application server) and placing the same into an internal table (remove the xml tags or say fetching the xml data without xml tags).

    Hi Murashali,
    use this.
    TYPES: BEGIN OF day,
    name TYPE string,
    work(1) TYPE c,
    END OF day.
    DATA: BEGIN OF week,
    day1 TYPE day,
    day2 TYPE day,
    day3 TYPE day,
    day4 TYPE day,
    day5 TYPE day,
    day6 TYPE day,
    day7 TYPE day,
    END OF week.
    DATA xml_string TYPE string.
    DATA result LIKE week.
    week-day1-name = 'Monday'. week-day1-work = 'X'.
    week-day2-name = 'Tuesday'. week-day2-work = 'X'.
    week-day3-name = 'Wednesday'. week-day3-work = 'X'.
    week-day4-name = 'Thursday'. week-day4-work = 'X'.
    week-day5-name = 'Friday'. week-day5-work = 'X'.
    week-day6-name = 'Saturday'. week-day6-work = ' '.
    week-day7-name = 'Sunday'. week-day7-work = ' '.
    CALL TRANSFORMATION ...
    SOURCE root = week
    RESULT XML xml_string.
    CALL TRANSFORMATION ...
    SOURCE XML xml_string
    RESULT root = result.
    Regards,
    Vijay

  • How to read a file and save the contents into array list

    i have textfile contains information like:
    Name: James Smith
    Customer no: 663,282
    Post code: BA1 74E
    Telephone no: 028-372632
    Last modified: Feb 10, 2008 6:50:00 PM GMT
    Name: Janet Smith
    Customer no: 663,283
    Post code: BA1 74E
    Telephone no: 028-372632
    Last modified: Jan 11, 2007 8:10:05 PM GMT
    etc...
    how can i read the contents of this textfile and put the data into an ArrayList called ArrayList<Customer> customerList.
    i knew that i need two classes, one for CustomerDetails and one for ReadFile.
    i have already done the customer class as:
    import java.util.Date;
    public class Customer
        String Name;
        int CustomerNo;
        String Postcode;
        String teleNo;
        Date lastModified;
        public Customer(String Name, int CustomerNo, String Postcode, String teleNo, Date lastModified)
         assign(Name, CustomerNo, Postcode, teleNo, lastModified);
        public void assign(String Name, int CustomerNo, String Postcode, String teleNo, Date lastModified)
         this.Name=Name;
         this.CustomerNo=CustomerNo;
         this.Postcode=Postcode;
         this.teleNo=teleNo;
         this.lastModified=lastModified;
        public String toString()
         String allDetails = "Name: "+Name+
             ", Customer No: "+CustomerNo+
             ", Postcode:"+Postcode+
             ", Telephone No: "+teleNo+
             ", Last Modified Date: "+lastModified;
         return allDetails;
    }i just wondering how can i code the ReadFile class?
    can anyone help me please. thank you in advance.

    thank you for your suggestion, but i have already started to code the readCustomer class using the Scanner.
    the code i got so far is:
    import java.util.Scanner;
    import java.io.*;
    public class readCustomer
        public static void main(String[] args)
         readCustomer("Customers.txt");
        public static void readCustomer(String filename)
         try {
             Scanner scanner = new Scanner(new File(filename));
             scanner.useDelimiter(System.getProperty("line.separator"));
             while (scanner.hasNext()) {
              processLine(scanner.next());
             scanner.close();
         } catch (FileNotFoundException e) {
             e.printStackTrace();
        public static void processLine(String line)
         Scanner scanner2 = new Scanner(line);
         scanner2.useDelimiter("\\s*:\\s*");
         String description = scanner2.next();
    *// here is where i am struggling. i don't know how to get the information after the : sign*   
    }i am currently struggling with the processLine method?
    also, i am not sure how to group a set of information and put them into the arraylist.
    Any hint, please. Thank you.
    Edited by: mujingyue on Feb 26, 2008 12:42 PM

  • How to read xml file present in the UCMS from  webcenter portal application

    Hi,
    I'm new to webcenter portal and would like to know how to read an xml file which is present in UCMS 11g(contributors folder) from webcenter portal application.
    Thanks in advance

    I guess I had mentioned that I want to read it via my webcenter portal app rather than login to ucms and searching it via url.
    I want text labels and button names being stored in the xml file which I'm going to keep in the UCMS.
    After reading that from the xml will be placed at appropriate locations like the button values and label feilds, so that we dont need to deploy entire app for this kind of simple changes.
    Now can anyone provide some help with the api's related to this?

  • How to read spool file and get the spool file number

    Hey everyone.
    I created a program ztemp that is calling another program ztemp2 within, ztemp2 creates a spool file. Now the requirement is I need to write a code within ztemp to download that spool request and then convert it to the pdf file. I know I can use program rstxpdft4 to convert the spool file to the PDF but for this I need to give the spool number, so can you please tell me how can I get the spool number and then fetch it to the program rstxpdft4 .
    Thank you.
    Rhul goel

    Hi,
       Please check the [link|Convert ABAP List to PDF and display without downloading first; (Rich's reply) and get the spool similarly.
    Or read from table TSP01 to get the latest spool using sy-uname.
    Regards,
    Srini.

  • Reading a file and parsing the data for a calculation method

    i am trying to read a file with 3 feilds double double and int . am able to read the file but i am getting an exception right befor i parse the data ...code
    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.*;
    //import com.sun.java.util.jar.pack.Package.File;
    public class FileTester {
    public static String mLine;
         public static void main(String[] args) {
              BufferedReader in = null;
              try{
              File f = new File ("loan.txt.txt");
              in = new BufferedReader(new FileReader(f));
              catch(FileNotFoundException e)
                   System.out.println("file does not exist");
                   System.exit(0);
              try{
              String mLine = in.readLine();
              while (mLine != null){
                   System.out.println(mLine);
                   mLine = in.readLine();
              }}catch(Exception e)
              {System.out.println(e.getMessage());
              String []data = mLine.split("\t");
              double loan = Double.parseDouble(data[0]);
              double interest = Double.parseDouble(data[1]);
              int term = Integer.parseInt(data[2]);
              System.out.println(loan+interest+term);
    afterwards i would like to break this up into three methods to feed the values to a calculation class

    Take a look at your while loop. It continues to loop as long as mLine != null. Therefore it stops looping when mLine IS = null. So can you now see why the following line of code would cause problems?
    String []data = mLine.split("\t");How is the data stored in your file? Is it a single line with the three values separated by a tab? If so you can do away with the while loop and just call readLine() once. Otherwise you will have to process each line you read inside the while loop.
    P.S. use the code button when posting code. There is a button above the textfield when use post a reply.

  • How to read a table and transfer the data into an internal table?

    Hello,
    I try to read all the data from a table (all attribute values from a node) and to write these data into an internal table. Any idea how to do this?
    Thanks for any help.

    Hi,
    Check this code.
    Here i creates context one node i.e  flights and attributes are from SFLIGHT table.
    DATA: lo_nd_flights TYPE REF TO if_wd_context_node,
            lo_el_flights TYPE REF TO if_wd_context_element,
            ls_flights TYPE if_main=>element_flights,
            it_flights type if_main=>elements_flights.
    navigate from <CONTEXT> to <FLIGHTS> via lead selection
      lo_nd_flights = wd_context->get_child_node( 'FLIGHTS' ).
    CALL METHOD LO_ND_FLIGHTS->GET_STATIC_ATTRIBUTES_TABLE
      IMPORTING
        TABLE  = it_flights.
    now the table data will be in internal table it_flights.

  • Read csv file and insert the data to a list in sharePoint

    Hi everyone,
    i wrote a code that reads from a csv file all his data but i need also to insert all the data to a new list in sharePoint.
     how can i do this?
    plus, i need to read from the csv file once a day in specific hour. how can i do this? thank you so much!!

    Did you look at the example I posted above?
    ClientContext in CSOM will allow you to get a handle on the SharePoint objects;
    http://msdn.microsoft.com/en-us/library/office/ee539976(v=office.14).aspx
    w: http://www.the-north.com/sharepoint | t: @JMcAllisterCH | YouTube: http://www.youtube.com/user/JamieMcAllisterMVP

  • How to read a file and save the line number of  the last line read?

    Hi,
    I am using RandomAccessFile and file as my class. I am trying to read a log file as it gets updated and print it out to a java window. i so far have the framework setup but dont know how to save the last line number so.
    i need this variable so i dont reprint out the same line numbers to the java window. please advise.
    thanks!

    hi,
    i now have the line number of the last line read, but now when i reopen the file, how can i skip that number of lines?
    thanks,

Maybe you are looking for