Microsoft InfoPath 2010
The official blog of the Microsoft InfoPath team

Submitting to a SharePoint List

Submitting to a SharePoint List

Rate This

As you know, submitting to a Microsoft Windows SharePoint form library from an InfoPath form is quite simple: just add a “submit” type of data connection to InfoPath and away you go. However, submitting to a SharePoint List is another matter. In this post, we will take a look at the steps necessary to enable this functionality.

Step 1: Create the list

1. Create a new custom list named: MyContacts
2. From the Settings button choose List Settings
3. Click Create Column
4. Add the following columns/data types:

  • FirstName, Single line of text
  • LastName, Single line of text
  • Email, Single line of text
  • Phone, Single line of text

The next step is to create a Collaborative Application Markup Language (CAML) template that contains the same XML nodes as the columns we added to our list – this will be used as a secondary data connection in the InfoPath Form Template.

Step 2: Create the CAML template

1. Launch Notepad (or any text editor)
2. Copy and paste the following code to the Notepad document:

<?xml version="1.0" encoding="UTF-8"?>
<Batch OnError="Continue">
    <Method ID="1" Cmd="New">
        <Field Name='Title'></Field>
        <Field Name="FirstName"></Field>
        <Field Name="LastName"></Field>
        <Field Name="Email"></Field>
        <Field Name="Phone"></Field>

3. Save this as: Add List Item Template.xml


Step 3: Create the InfoPath Form Template

1. Create a new, blank, browser-compatible form template
2. Add a “Receive” type secondary data connection to the Add List Item Template.xml file created in Step #2. (Make sure the options “Include the data as a resource file in the form template” and “Automatically retrieve data when the form is opened” are enabled.)
3. Add a “Receive” type secondary data connection to the “MyContacts” SharePoint List created in Step #1 and make sure the option “Automatically retrieve data when the form is opened” is enabled.
NOTE: Be sure to include the “Title” field along with the custom fields we created.

Each SharePoint list is created with a unique identifier called a GUID. In order to submit items to a SharePoint list, you must know the unique GUID for that list. These next steps will enable you to identify the GUID for your “MyContacts” list.

Step 4: Identify the list GUID

1. Open a browser and navigate to the MyContacts list
2. From the Settings menu choose List Settings
3. In the browser’s address bar you will see the URL appended with “List=”


4. Copy everything after the equals sign and paste this into a text editor as we will need this value later on.

NOTE: We will need the list GUID to be formatted as “{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}”. If your GUID appears as above with the hyphens and braces “escaped” (i.e. %7B for the braces and %2D for the hyphens) then you will need to replace the escaped characters with the braces and hyphens so when we use this GUID later, it will appear as: {1E76517B-2C36-4473-A420-A737D98589BC}

Step 5: Add controls to the InfoPath Form Template

1. Open the Data Source Task Pane
2. From the Data Source dropdown box choose the “MyContacts” connection

3. Right-click on “MyContacts” and choose Repeating Table – this will add a repeating table bound to that connection to your View
4. From the Data Source dropdown box choose Main
5. Add a text box to the “myFields” node named: ListName and set the Default Value property to the GUID value of your list – we will use this node to specify the list when we perform the Submit operation


To update the SharePoint list we will be using the “UpdateListItems” method of the SharePoint “lists.asmx” web service. This web method requires a couple of parameters (the list name and what gets updated) – now that we have added the “ListName” node which contains the GUID and we have the Add List Item Template XML data connection which describes our data structure we have all the necessary information to add the “UpdateListItems” web method!

Step 6: Add the “lists.asmx” web service

1. Add a new “Submit” type of web service data connection to the “lists.asmx” web service – this is typically located at: http://servername/_vti_bin/lists.asmx
2. Select the “UpdateListItems” operation
3. Double-click the “listname” parameter and assign the “my:ListName” node as the value

4. Double-click the “updates” parameter, select the “Add list Item Parameter” data source, select “Batch” and click OK
5. For the “Include” option select “XML subtree, including selected element”

6. Complete the Data Connection Wizard

Now that we have all the connections that are required, we now need to add the “submit” functionality to the form template.

Step 7: Add Submit functionality

1. Display the Data Source Task Pane
2. From the Data Source dropdown box choose the Add List Item Template data connection
3. Drill down through the data source, right-click on the Field node and choose Repeating Table


We need to change the text box control in the “Name” column to Read-only – if these values were to be changed it would affect the CAML and the submit would fail.
• Double-click on the text box in the Name column of the Repeating Table
• Select the Display tab
• Enable the Read-only property and click OK
• Add a new Button control to the View
• Double-click the button to display the Properties
• Click the Submit Options button
• Enable the option “Allow users to submit this form”
• Enable the option “Perform custom action using Rules” and click the Rules button
• Click the Add button
• Click the Add Action button
• From the Action dropdown box choose “Submit using a data connection”, select the “Web Service Submit” data connection and click OK
• Click the Add Action button
• From the Action dropdown box choose “Query using a data connection”, select the “MyContacts” data connection and click OK (this will automatically refresh the list in InfoPath so you can see the newly added record)

• Click OK until you are back to your form

NOTE: If you want to automatically clear out the submitted values, add another action to this Rule to “Set a field’s value” and the only option you need to specify is the “Field” option – select the “Field” node from the “Add List Item Template” data connection and then simply leave the Value option blank.

Step 8: Test!

1. Click the Preview button to preview the form
2. Fill in values for each of the fields: Title, First Name, Last Name, E-mail and Phone

3. Click the Submit button – the contact information should be submitted successfully and the “MyContacts” list automatically updated!

A special thanks to Matt Faus of InfoPathDev for for initially posting this solution!

Scott Heim
Support Engineer

Leave a Comment
  • Please add 6 and 1 and type the answer here:
  • Post
  • Hi Confused and dismayed,

    If you did step 1 and clicked the Next button then you will see the list of operations available to you, one of which is UpdateListItems.


  • I tried but i am getting error

    Some rules were not applied?

  • Hi Zubair,

    That is not anywhere near enough information for me to provide any suggestions other than...the steps in the blog work. If you are having problems, start fresh and follow the steps *exactly* as I have them. If you still run into a problem then please provide more information other than you're getting an error.


  • Is there any way of submitting this to a list with anything other datatypes than single line of text?

  • Hi Dominic,

    Yes - peruse all the comments as there are numerous entries about how to do this.


  • Haha thanks Scott, I didn't see that there was a more comments option.

    I've checked and now that I have found them all. I'm thinking there is no way of making this work for a content_type: Event, so that I can use a form to add to a Sharepoint Calendar. (even though this comes under lists)

  • So I have successfully submitted items to a Calendar via this method but just using the built-in column types (i.e. DateTime, Single Line of Text, Number, etc.) I've not tried adding something outside of those.


  • I have:

    <?xml version="1.0" encoding="UTF-8"?>

    <Batch OnError="Continue">

       <Method ID="1" Cmd="New">

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

           <Field Name="Start_Time">2013-07-11 12:00:00</Field>

           <Field Name='End_Time'>2013-07-11 12:00:00</Field>



    and in Sharepoint:

    Column (click to edit) Type Required  

    Title  Single line of text   Required

    Location  Single line of text  

    Start Time  Date and Time   Required

    End Time  Date and Time   Required

    Description  Multiple lines of text  

    Created By  Person or Group  

    Modified By  Person or Group  

  • Hi Dominic,

    So if you are using the built-in Calendar columns, then the problem you are having is "Start Time" and "End Time" are NOT the actual underlying names for those columns - they are:



    I realize this is not obvious so to see all the actual names, you can do this:

    - Create a new XSN

    - Add a Receive data connection to your calendar

    - File the File tab, choose Publish and then click the Export Source Files button

    - Export these to a local folder

    - Open manifest.xsf with a text editor (i.e. Notepad - just make sure you do NOT allow Notepad to be the default application for opening this file)

    - Scroll to the bottom and you will see the actual SharePoint names for all the columns

    I would also suggest you test this in "steps" - have your XML file only be for the "required" columns (Title, EventDate and EndDate) - once you have this working, then add others.


  • Thanks Scott, that's explained everything.

    Don't suppose you came across how to make it an all day event, using infopath?

    If not, no worries. Will try it out.

    Kind Regards,

  • Hey Dominic - unfortunately I have not tried that. :(

  • Found it.

    I looked at the sharepoint form source code and found the name as fAllDayEvent - Yes/No = 1/0

    So I plugged this is to my CAML:

    <Field Name="fAllDayEvent">1</Field>

    Thanks again for all the help.


  • Hi Dominic,

    That's great to hear!


  • Hi Scott ,

    Thanks alot for the wonderful post , I have implemented this successfully. Here we are using InfoPath form for New form , How can have the same functionility for the Edit form in the list too? . If I customize the list using Infopath form , it ll have lot of limitations. Is this possible to extent this to edit form also?

    Thanks and Regards,

    Nandini Prasad

  • Hi Nandini,

    This method is simply for taking data from an InfoPath form and adding/updating a SharePoint list. If you are using SharePoint 2010 and InfoPath 2010, then you can simply "customize" your form for a specific list using InfoPath. For example:

    - Create a new custom list

    - Select the Ribbon for the list

    - Click the "Customize form" button on the Ribbon

    This will launch InfoPath and you can customize the form, publish it back to that list and now your InfoPath form will be used for the Display, New and Edit forms.

    Note there are some limitations for this:

    - You cannot add code behind a form that is for a list

    - The form will only submit to this one list. You may be able to add similar functionality to what this blog post describes but again, no code


Page 31 of 37 (550 items) «2930313233»