Problems with CAML/BATCH/Submitting - InfoPath Dev
in

InfoPath Dev

Problems with CAML/BATCH/Submitting

Last post 06-25-2008 08:25 AM by aevay. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 06-25-2008 08:25 AM

    • aevay
    • Not Ranked
    • Joined on 06-16-2008
    • Posts 8

    Problems with CAML/BATCH/Submitting

    Based originally on this tutorial from MSDN; http://msdn.microsoft.com/en-us/library/cc162745.aspx#ip2007SubmitDataSPList_AddingaConnectiontotheListsWebServiceandSpecifyingtheParametersoftheUpdateListItemsWebMethod

    ... the form does submit, and a new item is created, all the fields are just empty.

    I created the Document Library through the Publishing option through InfoPath.

    In my form, one field is named 'OptionA'; In my form I have eight fields, and for the sake of simplicity I'll only focus on that one. Within the Batch CAML fragment 'Template.xml' I've defined the following;

    <batch onerror="Return">
    <method id="1" cmd="New">
    <-- .... -->
    <field name="OptionA"></field>
    <-- .... -->
    </method>
    </batch>

    Then in my source I've limited the MSDN source to what I needed for submitting only since I have no need to read information from the list yet.

    I've set a submit button up to execute custom code, where in the _Submit method I've defined the following;

    XmlNamespaceManager ns = this.NamespaceManager;
    DataSource dsCAML = this.DataSources["Template"];
    XPathNavigator xnCAML = dsCAML.CreateNavigator();
    WebServiceConnection wsSubmit = (WebServiceConnection)this.DataConnections["Web_Service_Submit"];
    XPathNavigator xnDoc = this.MainDataSource.CreateNavigator();
    XPathNodeIterator xiNewFields = xnDoc.Select("/my:myFields", ns);

    if (xiNewFields.Count > 0)
    {
    while (xiNewFields.MoveNext())
    {
    xnCAML.SelectSingleNode(
    "/Batch/Method/Field[@Name='OptionA']", ns)
    .SetValue(xiNewFields.Current.SelectSingleNode(
    "my:OptionA", ns).Value);

    // ...
    }

    xnCAML.SelectSingleNode("/Batch/Method/@Cmd", ns).SetValue("New");
    wsSubmit.Execute();
    }
    // ...

    Does anyone see a disconnect in this mapping which would prevent my form information from being properly submitted to the Document Library?

    Like I said, the form does submit, and a new item is created, all the fields are just empty.

    Edit / Update: This is what OptionA as a field looks like in my Document Library;

    <Field DisplayName="OptionA" ReadOnly="TRUE" Node="/my:myFields/my:OptionA" Type="Text"
    Group="Microsoft Office InfoPath" XName="{7D93291E-27AA-4EB6-9C36-53C9D4804B74}"
    ID="{d7ad1862-18bf-4a12-aa77-bcbd9df8c473}" SourceID="{3b2ae548-9f42-43f8-961f-9267d6421f24}"
    StaticName="OptionA" Name="OptionA" ColName="nvarchar13" RowOrdinal="0" />
Page 1 of 1 (1 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.