Peter Wirdemo
Peter Wirdemo

Reputation: 526

Use UpdateListItems webbservice on Sharepoint using Infopath form without managed code

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.

Upvotes: 4

Views: 6389

Answers (4)

Hans Carlsson
Hans Carlsson

Reputation: 21

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">

Upvotes: 2

Dimitar Alexandrov
Dimitar Alexandrov

Reputation: 11

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.

Upvotes: 1

Stu Behagg
Stu Behagg

Reputation: 1

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.

Upvotes: 0

ErinsMatthew
ErinsMatthew

Reputation: 590

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>

Upvotes: 0

Related Questions