Add a new SharePoint list using an InfoPath form

This InfoPath video is a demonstration of an InfoPath 2013 form that can be used to create a new SharePoint list on a SharePoint site and add columns to the newly created SharePoint 2013 list.

While you can create a new SharePoint list without writing code, that SharePoint list would not have any columns added to it other than the default Title column. To be able to create a new SharePoint list and add columns to it, you must write code.

There aren't many options to create a SharePoint list using an InfoPath form when it comes to writing code to provide such functionality. While you could use classes and methods from either the SharePoint Server Object Model or the SharePoint Client Object Model, doing so would force you to publish the InfoPath form template that calls such code as an administrator-approved form template.

To avoid having to administrator-approve a form template that contains code that can create new SharePoint lists, you can make use of the Lists web service of SharePoint to create new SharePoint lists from within InfoPath and add new columns to the newly created SharePoint lists. The following InfoPath demo video shows you how such a solution would work.

InfoPath 2013 with SharePoint 2013 demo video transcript

Here I'm in SharePoint 2013 where I've already published an InfoPath form template to this SharePoint form library, so if I click new document to add a new form, you'll see that as soon as the InfoPath form opens, it will display this text box control on it in which I can enter a new name for the SharePoint list, and this bulleted list control to which I can add items that will become single line of text columns in the SharePoint list. You could modify this solution in such a way that users could select a data type for each column that is added, but I'm keeping things simple here and just adding single line of text fields.

So I'll enter a name here for my new SharePoint list. I'll call it Office Applications. And my first column name will be Off App Name, and the second one Off App Color. When I click Submit, a SharePoint list should be created, and then when I go to the Site Contents page, we should see the new SharePoint list listed. And as you can see, we've got an Office Applications list here that was created a minute ago. So I'll click and open it. And then here you can see it has 3 columns, and these were the 2 new columns that I added. And if I go to the List Settings page, we should see that those columns are Single line of text columns.

I can repeat the process and add a second SharePoint list. Let's call it Testing List, and I'll add 3 columns this time: Column 1, Column 2, and Column 3. And then hit Submit again, go to the Site Contents page, and then we should see Testing List here listed and it was created a minute ago. So I'll click it, and then you'll see my 3 columns here. And then again if I go to the List Settings page, we should see that we've got 3 Single line of text columns.

This InfoPath form makes use of code, but the code does not require Full Trust to run, so the form template can be published directly to a SharePoint form library without having an administrator do anything for you.

See more InfoPath 2013 tutorial videos »

 


Related InfoPath Articles:

 

Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author.

InfoPath 2013 Cookbook: 121 Codeless Recipes for Beginners

InfoPath 2013 Cookbook 2: 121 Codeless Recipes for SharePoint 2013

InfoPath 2010 Cookbook: 101 Codeless Recipes for Beginners

InfoPath 2010 Cookbook 2: 101 Codeless Recipes for SharePoint 2010

InfoPath 2010 Cookbook 3: 101 Code Recipes for C# Developers

InfoPath 2010 Cookbook 4: 101 Code Recipes for VB Developers

InfoPath 2010 Cookbook 5: Integrating InfoPath with Excel and Excel Services