SIGN UP MEMBER LOGIN:    
ARTICLE

Creating Installable InfoPath form Template and deploying in SharePoint

Posted by Vivek Srivastava Articles | SharePoint December 19, 2010
In this article I will explain how can we create and publish browser enabled InfoPath form in SharePoint site.
Reader Level:

In this article I will explain how can we create and publish browser enabled InfoPath form in SharePoint site.

Steps Involve

1. Step 1: Design info path form
2. Step 2: Creating Installable InfoPath form Template
3. Step 3: Deploying form in SharePoint


Step 1: (Design Info Path Form)

To design InfoPath form please refer to my previous article "Creating browser enabled InfoPath forms for SharePoint library"

After designing form Right click on button control (which you have added in your form) and select button properties.

image1.gif

Select Submit from the "Action" dropdown and Change the label of button and click on "Submit Option" button. Click on "Submit Option" button.

image2.gif

From submit options popup, Click on "Allow users to submit this form "check box, select "Perform custom action using Code" and click on "Edit Code…" button.

image3.gif

Now Visual Studio project will be open where you can write your code to submit data into SharePoint library.

Steps to select your programming language and project location(Before clicking on Edit Code
button)

  1. Go to "Form Options" from the Tools menu.
  2. Click on "Programming" tab. Here you select From template code language and you can browse
    code location as well.

    image4.gif

Add SharePoint reference in your SharePoint solution.

using Microsoft.SharePoint;

Write following code to "FormEvents_submit" event.

public void FormEvents_Submit(object sender, SubmitEventArgs e)

        {

            XPathNavigator root = this.MainDataSource.CreateNavigator(); 

            SPSecurity.RunWithElevatedPrivileges(delegate()

            {

                using (SPSite site = new SPSite("http://maaasdw002:3304"))

                {

                    using (SPWeb web = site.OpenWeb())

                    {

                        SPList list = web.Lists["CustInfo"];

                        SPListItem newItem = list.Items.Add();

                        newItem["Title"] = root.SelectSingleNode("/my:myFields/my:custTitle", this.NamespaceManager).Value;

                        newItem["CustName"] = root.SelectSingleNode("/my:myFields/my:custName", this.NamespaceManager).Value;

                        newItem["Age"] = root.SelectSingleNode("/my:myFields/my:Age", this.NamespaceManager).Value;

                        newItem["Address"] = root.SelectSingleNode("//my:myFields/my:Address", this.NamespaceManager).Value;

                        newItem.Update();

                    }

                }

            });

            e.CancelableArgs.Cancel = false;

            // Write your code here.
        }

        In the above code XPathNavigator is an object to navigate InfoPath

Step 2: (Creating Installable InfoPath Form Template)

From the design task pane click on "Publish Form Template". From publishing wizard select first option to publish form in share point and click on next button.
 

image5.gif

Enter the URL of SharePoint site and click on next button.

image6.gif

From the next window select "Administrator-approved form template" and click on next button and click on Publish button to publish form.

image7.gif

Specify a location and file name for the form template and click on next - next button and click on Publish button to publish the form.
 

image8.gif
image9.gif

Step 3: (Deploying InfoPath form in SharePoint)

Open Central Administrator go to "Application Management" and click on "Upload Form template" from InfoPath Forms Services section
 

image10.gif

A new window will be open to upload form template. Browse the template location and click on upload button to upload form template.
 

image11.gif


Now go to your SharePoint site settings and select "Site collection features".
 

image12.gif

Search your form template and click on Activate button to activate the form.
 

image13.gif

After activating form template go back to site settings page and select "Site Libraries and lists" from the Site libraries and lists.
 

image14.gif

Select Form Templates Library and go to the form template library and click on your template.
 

image15.gif

A new form will be open in the browser( to open form in the browser go to Document Library settings>>Advance settings and select "display as a web page")

Fill the form and click on save data button to save data in the list.
 

image16.gif

Open "CustInfo" list to view your data.
 

image17.gif

In my next article I will explain how can How can we open info path forms inside the SharePoint web page.

Thanks for reading...
  

Login to add your contents and source code to this article
share this article :
post comment
 
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
Team Foundation Server Hosting
Become a Sponsor