<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Trouble Updating SP List From InfoPath</title><link>https://www.infopathdev.com:443/forums/thread/101002.aspx</link><pubDate>Tue, 03 Feb 2015 20:20:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:101002</guid><dc:creator>jlarremore</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/101002.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=101002</wfw:commentRss><description>I am one step away from getting this to work. I am trying to update a SP 2010 list using InfoPath 2010. My functionality is working except when I submit the data does not update. I am updating in the form code. I have no clue why it is not updating. Any help is appreciated. 
 
 
This is what I based my solution on:
 
 
 

http://jaliyaudagedara.blogspot.com/2011/03/submitting-data-to-sharepoint-2010-list.html

 
Here is my code: 
 
using Microsoft.Office.InfoPath;
using System;
using System.Xml;
using System.Xml.XPath;
using System.Windows.Forms;


namespace Sym
{



    public partial class FormCode
    {


        // Member variables are not supported in browser-enabled forms.
        // Instead, write and read these values from the FormState
        // dictionary using code such as the following:
        //
        // private object _memberVariable
        // {
        //     get
        //     {
        //         return FormState[&amp;quot;_memberVariable&amp;quot;];
        //     }
        //     set
        //     {
        //         FormState[&amp;quot;_memberVariable&amp;quot;] = value;
        //     }
        // }

        // NOTE: The following procedure is required by Microsoft InfoPath.
        // It can be modified using Microsoft InfoPath.
        public void InternalStartup()
        {
            ((ButtonEvent)EventManager.ControlEvents[&amp;quot;UpdateBtn&amp;quot;]).Clicked += new ClickedEventHandler(UpdateBtn_Clicked);
        }

        public void UpdateBtn_Clicked(object sender, ClickedEventArgs e)
        {
            // Write your code here.

            try
            {
                XPathNavigator root = MainDataSource.CreateNavigator();
                XPathNavigator myNavigator =   this.DataSources[&amp;quot;Supplier Routing Receive&amp;quot;].CreateNavigator(); 
                // Retrieve the values for the separation list item
                string ListName = root.SelectSingleNode(&amp;quot;/my:myFields/my:ListName&amp;quot;, NamespaceManager).Value;//Setting the GUID
                string eTitle = myNavigator.SelectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Title&amp;quot;, NamespaceManager).Value;
                string eVName = myNavigator.SelectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Vendor_x0020_Name&amp;quot;, NamespaceManager).Value;
                string eWebPort = myNavigator.SelectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Supplier_x0020_Web_x0020_Portal&amp;quot;, NamespaceManager).Value;
                string eEmailDS = myNavigator.SelectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Supplier_x0020_Email_x0020_Addre0&amp;quot;, NamespaceManager).Value;



                if ((eWebPort == &amp;quot;Yes&amp;quot;) || (eWebPort == &amp;quot;No&amp;quot;))
                {
                   

                }
                else
                { 
                 MessageBox.Show(&amp;quot;Supplier Web Portal must be either Yes or No&amp;quot;);
                }
                


                if (ListName == null)
                {

                }
                else
                {
                    //This is CAML xml file. it contains batch and method nodes
                    XPathNavigator batch = DataSources[&amp;quot;Submit&amp;quot;].CreateNavigator();

                      batch.SelectSingleNode(&amp;quot;/Batch/Method/Field[@Name=&amp;#39;Title&amp;#39;]&amp;quot;, NamespaceManager).SetValue(eTitle);
                      batch.SelectSingleNode(&amp;quot;/Batch/Method/Field[@Name=&amp;#39;Vendor Name&amp;#39;]&amp;quot;, NamespaceManager).SetValue(eVName);
                      batch.SelectSingleNode(&amp;quot;/Batch/Method/Field[@Name=&amp;#39;Supplier Web Portal&amp;#39;]&amp;quot;, NamespaceManager).SetValue(eWebPort);
                      batch.SelectSingleNode(&amp;quot;/Batch/Method/Field[@Name=&amp;#39;Supplier Email Address for Info Requests&amp;#39;]&amp;quot;, NamespaceManager).SetValue(eEmailDS);

                    DataConnections[&amp;quot;Web Service Submit&amp;quot;].Execute();

                  //  MessageBox.Show(batch.SelectSingleNode(&amp;quot;/Batch/Method/Field[@Name=&amp;#39;Supplier Email Address for Info Requests&amp;#39;]&amp;quot;, NamespaceManager).Value.ToString());
                   
                }
            }
            catch (Exception ex)
            {

                 MessageBox.Show(ex.Message.ToString());
                
            }



        }
    }
    }</description></item></channel></rss>