3

I have the following code in a InfoPath form that should update a list with items from a repeating table.

For some reason the code runs i get no errors but the list is not updated with the items, can't seem to figure out why the data connection that submits uses: http://servername/_vti_bin/lists.asmx?

Can someone take a look and let me know if they see anything obvious.

            // Delete all Method nodes from the CAML Batch XML

        XPathNavigator secDSNav = DataSources["CustomListCAML"].CreateNavigator();
        XPathNodeIterator iter = secDSNav.Select("/Batch/Method");
        int methodNodesCount = iter.Count;

        XPathNavigator firstMethodNav = secDSNav.SelectSingleNode("/Batch/Method[1]", NamespaceManager);
        XPathNavigator lastMethodNav = secDSNav.SelectSingleNode("/Batch/Method[" + methodNodesCount.ToString() + "]", NamespaceManager);

        firstMethodNav.DeleteRange(lastMethodNav);

        // Retrieve the rows of the repeating table

        XPathNavigator root = MainDataSource.CreateNavigator();
        XPathNodeIterator rows = root.Select("/my:myFields/my:RepeatingCheck/my:CheckTable", NamespaceManager);

        // Loop through the rows of the repeating table
        // and construct the CAML Batch XML
        int counter = 1;
        while (rows.MoveNext())
        {

            // Retrieve the title
            string Check = rows.Current.SelectSingleNode("my:Check", NamespaceManager).Value;
            Check = SecurityElement.Escape(Check);
            string Service = rows.Current.SelectSingleNode("my:Service", NamespaceManager).Value;
            Service = SecurityElement.Escape(Service);
            string Outcome = rows.Current.SelectSingleNode("my:Outcome", NamespaceManager).Value;
            Outcome = SecurityElement.Escape(Outcome);
            string ActionNotes = rows.Current.SelectSingleNode("my:ActionNotes", NamespaceManager).Value;
            ActionNotes = SecurityElement.Escape(ActionNotes);
            string Ticket = rows.Current.SelectSingleNode("my:TicketRaised", NamespaceManager).Value;


            // Add an item to the CAML Batch XML
            AddMethodNode(counter, Check, Service, Outcome, ActionNotes, Ticket);


            // Increment the counter
            counter++;
        }

        // Submit the rows to the Lists web service to update the custom list
        DataConnections["ListItemsSubmit"].Execute();
    }
}
}
1
  • I know this is old, but I am running into the same issue. I see you are following the guide from bizsupportonline and just want to clarify what I have found through trouble shooting. If you edit your AddMethodNode to only set up the title field, it will update the list (providing everything else is done correctly). This issue only seems to be comming up when you try add other columns. I am hoping to find a solution for this today, if I do I will come back and leave an answer. Jul 29, 2016 at 13:58

1 Answer 1

0

If I waited just a bit longer I could have just posted the answer! Basically the issue comes from the fact that you need to supply the internal name of the list column. Even though my Batch/Caml xml file had the name of the column as displayed in the list, these names were not the internal names used by SharePoint.

To find the internal name of the column go to: ListSettings > Cloumn (like you are trying to edit the column) > Look at the URL on the column edit page.

when you are looking at the URL of the column, the internal name of column is everthing after Field=

Examples of internal name:

1) -Your URL Path-/_layouts/FldEdit.aspx?List=%7BF2A8469A%2D93F0%2D4D34%2DA9A9%2D51A21D70F4FD%7D&Field=Title

So for example one, the internal name is Title

2) -Your Url Path-/_layouts/FldEdit.aspx?List=%7BF2A8469A%2D93F0%2D4D34%2DA9A9%2D51A21D70F4FD%7D&Field=Total%5Fx0020%5FPrice

Example two is a little different because you will have to conver the %5F to an "_". So this internal name is Total_x0020_Price

Now I do want to point out that in my Batch I did have the proper internal name (did not know it was the internal name at the time) but it did not get updated. I believe this is because the update had already failed before it got to that column, and the bizsupportonline does not have the OnError="Continue" attribute in its CAML.

Resources/Credits that got me to a solution:

1) Stack Overflow-First Answer

2) Finding the internal name

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.