4

I need to create a Infopath form that users can use to create posts and update a Sharepoint list.

I have located the list GUID and the Lists.asmx webbservice. I have made sure that I am admin with full rights on the List in question. The list is a basic 2 column (1 line of text).

I have created the CAML template:

<?xml version="1.0" encoding="UTF-8"?>
<Batch OnError="Continue">
    <Method ID="1" Cmd="New">
        <Field Name="Field1"></Field>
        <Field Name="Field2"></Field>
    </Method>
</Batch>

Two data connections using the CAML:

XML-file - loading the CAML.
Send data using Lists.asmx-service - "UpdateListItems"-method. 

The parameters for the UpdateListItems : tns:listName connected to a variable containing the GUID. tns:updates connected to /Batch in loaded CAML, XML-subtree included.

I have added a Repeating Table using the XMLfile-connection (CAML) where I can fill the column values for the new Listitem.

I have added a button that triggers action rules that use the dataconnection and "UpdateListItems"-method. The button also is tested trigger other rule actions, so the button itself works.

As I try post a new item to the sharepoint-list I receive no error message, everything seems to work fine, but no items is created.

If I change anything, like the GUID or other things, I recieve different error messages, so it appears as Infopath thinks everything works fine, but Sharepoint isn't doing anything with my list. No items is created.

Anyone has any idea of what could it be that goes wrong?

Edit: I have used other webservices from the same Sharepoint-server without any problems.

Peter Wirdemo
  • 498
  • 2
  • 11
  • 25

4 Answers4

2

This suggestion may be a bit dated, but...

I just had a similar problem. By using ULSViewer on the SharePoint server and reading the MSDN documentation I figured out that the Name attribute in the CAML Field tag should be the internal name Sharepoint assigns to your list column when you create it. In my case I had to change the CAML from:

<Field Name="pub1"> 

to 

<Field Name="_x0066_ub1">
  • Sorry it is 2017 and I still try to learn InfoPath... I have similar problem with yours. I can add new record but all the fields are blank. I am not sure which part is wrong. How should a proper XML schema should look like? – Mark Mar 10 '17 at 08:18
  • I fixed it. The submit button have an action "close this form". The action will run before any code behind. Therefore new record is not added! – Mark Mar 10 '17 at 09:24
1

I had the same problem - you have to point the Web service submit to site /_vti_bin/lists.asmx not to server /_vti_bin/lists.asmx. For example your site is on address server/site, you should use server/site/_vti_bin/lists.asmx, not server/_vti_bin/lists.asmx. My problem was with some subsites, so you could check it if it's the same to you.

slavoo
  • 5,798
  • 64
  • 37
  • 39
0

When creating new items using UpdateListItem, you need to include a Field tag for the list's ID column. It should be formatted as such:

<Field Name='ID'>New</Field>
ErinsMatthew
  • 591
  • 4
  • 11
  • Since you do not get an error message, you might try to run the code while a tool like [Wireshark](http://www.wireshark.org/) is running. You will be able to see the network traffic, and may get a better idea of what the issue is. – ErinsMatthew Nov 27 '13 at 09:39
0

Is Title still a required column in your list (it is by default). If so, try adding that to your XML:

<Field Name='Title'></Field>

and I dont think that

<Field Name='ID'></Field>

is required when doing a NEW command (inserting a new list item), but it is required for an UPDATE command (updating an existing list item) - I certainly didnt need it when I tested this.

  • 1
    Tried with and without 'Title' and 'ID' fields, and all combinations, now but the same result remains. I also tried remove ID="1" from '', no success. – Peter Wirdemo Dec 20 '13 at 06:40