com Page 1 of 7


How to use the SubmitToSharePointList command
The SubmitToSharePointList command features the ability to submit data from an InfoPath form to the SharePoint list it has been mapped to. It also allows updating of an item in the SharePoint list from the form by populating a field specified in the command with the SharePoint list item ID. This command requires the use of Qdabra’s InfoPath to SharePoint List Tool to obtain the XML file that will be used for mapping the fields in the InfoPath form to the columns in the SharePoint list. Refer to this blog post for in-depth instructions on how to use the tool. Follow these steps to obtain and inject the mapping.xml file in your InfoPath form template and be able to use the SubmitToSharePointList qRules command. As an example, we will use a simple InfoPath form template (injected with qRules v2.0) that has a repeating table with the fields: id, title and value:

We will then map these fields onto our SharePoint list which also has three columns:

1. 2. 3. 4. 5. 6.

Launch InfoPath to SharePoint List Tool and go to the Define Mapping tab: In the Source XSN field, attach the InfoPath form template (XSN). Enter the root SharePoint site in the Target SharePoint Site URL field, e.g. http://SharePointSite Click on the Get SharePoint Lists button. In the SharePoint Lists dropdown, select the list you wish to submit items to, in this case, “My Renamed List”. Click on the Extract Schemas button.

Copyright 2009 Qdabra Software. All rights reserved.

Revised: 2011-03-15 3:41:07 PM

which in this case is my:myFields/my:group1/my:group2 9. 10. 12.xml file that’s been saved in Step 11. 13.asmx where <SharePointSite> is the root site where the SharePoint list is. Go to Tools > Data Connections and add a receive data connection.www. Copyright 2009 Qdabra Software. 16. Select XML document as the source of your data and browse to the mapping. although we can use any filename. click on the Save As qRules Mapping button. 8. we will have to check the box “Data is from repeating group” in the Mapping Definition section. and then select the corresponding SharePoint Column to map the fields to. Click on the icon to display the Schema Tree taskpane and select the repeating group for your data. 14. For simplicity.xml. 15. In this example. Once done. All rights reserved. close the tool and open the form template in InfoPath Design mode. we will call this data connection “mapping”.qdabra. Click on the icon in each Form Field row to select the fields from the Schema Tree taskpane. Since we’re using a repeating group in our form. 11. Revised: 2011-03-15 3:41:07 PM . Add another data connection that submits data to a Web Service since SharePoint uses a web service for the list methods. The URL should be: http://SharePointSite/_vti_bin/lists. Save the mapping as an XML file in your local drive. Leave the default to include the data as a resource file in the form template and allow automatic retrieve on form open.com Page 2 of 7 7. When done mapping. we will leave the default name as mapping.

For the listName parameter. select the ListCollection node from the mapping secondary data source: Copyright 2009 Qdabra Software. All rights reserved. select UpdateListItems.www. In the list of operations. 18.com Page 3 of 7 17. Revised: 2011-03-15 3:41:07 PM .qdabra.

including selected element: Copyright 2009 Qdabra Software.www. select the Batch group node: 20.qdabra.com Page 4 of 7 19. Revised: 2011-03-15 3:41:07 PM . For the updates parameter. All rights reserved. Select to include the updates parameter as an XML subtree.

Copyright 2009 Qdabra Software. it should be the relative XPath to the ID field in the form. We will name this data connection as ShPSubmit. the column in SharePoint will be blank. All rights reserved.qdabra.com Page 5 of 7 21. 22.www. If an xpath is not found. Add a rule to the Submit button to set the value of the QdabraRules Command field into SubmitToSharePointList /submit=ShPSubmit /mapping=mapping /id=my:id  Note: When specifying the /id parameter and the data is from a repeating group. Revised: 2011-03-15 3:41:07 PM .

All rights reserved. try submitting new list items by filling out the Title and the Value fields and clicking Submit. Finally. Revised: 2011-03-15 3:41:07 PM . in Preview mode.qdabra. Copyright 2009 Qdabra Software.www.com Page 6 of 7 23. You should see that the item gets submitted to the SharePoint list it has been mapped to and returns the list item ID back in your form.

com Page 7 of 7 To update the existing items in the SharePoint list from the InfoPath form. The fields you are trying to submit to SharePoint need to be elements. enter the list item ID and the new values.qdabra. then re-submit. Revised: 2011-03-15 3:41:07 PM . Copyright 2009 Qdabra Software.www. Both the SubmitToSharePointList command and the InfoPath to SharePoint List Tool will not work with attributes. All rights reserved.