In this post I would like to share the combination of little efforts using Infopath 2010 forms. In this post I will Design a new InfoPath form 2010 and that form will insert into the SharePoint list by using share Point object model.
Scenario : I have Created a List name Location, having Column Title, City and ZipCode. I will be inserting in the Location List by using InfoPath Form.
Before we need to add the Event handler for the button to submit the item to the SharePoint list. just right click the button, select properties.
Click Edit Form Code, after click Info path will open the Visual studio 2005 , with the event of button. Once VS2010 Open we need to Add the reference of Microsoft.SharePoint dll to the project. After use the following code to insert in the SP List
we can Access the Fields which we defined in the Info path by Xpath of each field check the blog for more clarification..Access Info Path Field using Xpath.
Build the VS2005 and Close after successful build. Now our InfoPath design work has been done. we need to check some more options for publishing it and attached it to the webpart.
Once we design the Form, we need to go to the Developer Tab —- > and choose Language option as mentioned in the below screen shot.
here we need to set some notes which will help us to deploy the info path form easily. First option is the filler feature , i checked only the Print option. for more info regarding the info path filler feature use the this Filler Feature.
Now select Security and Trust , option and marked as Full trust , below screen shot.
Choose the preferred programming language, and Then select the Compatibility option. here we need to set this Info path form as web browser form and also mentioned the url of info path web service which can let it open in browser. screen shot is below.
Save the form, and go to file and Select Publish option. In the published option choose the SharePoint server, enter the site url, it will create and new content type and give the published version of infopath which we can save it in our local drive.
now after this wizard save the xsn file to your local hard drive. this .xsn we will upload and will deploy.
now do the next next and published it.
Now this published wizard has created a new content type in the Server and give us a publised, administrator approved template.
Note : Actually in the real world, we will design the info path form and just save it, than go to the Site Administrator, who will published it, give us a new approved template copy and create a content type on the server, because he is the administrator.
Now we need to to upload (the published .xsn file ) it on the Central Adminitration — > General Application setting –> Info Path Form Services, select Upload form template.
Browse the .xsn file which we save it on our local pc, once upload the form template , we can verify, and upload successfully.
Now we need to go to the Site Collection Administration — > Site Collection Feature—-> in the feature we can have the newly uploaded info path form feature , activate it.
To check the form is ready or not, go to the Site action –> and Select All Site content— go to the Form Template Library , in that library you will have your newly deployed info path form.
Note : It is better to Create a New Content Type, and Select Parent Content Type as Microsoft InfoPath. Then newly featured Activated form deployed on the site will come in the drop down.
Now ,we can get the name of content type of this form by select the library setting and go down and get the content type name, this content type will be required for newly document form library, which will help us to integrate this published form to info path viewer webpart.
once we scroll down
now we know the content type name of this form, now we need to add new form library, and set the content type of that newly library as highlited above. thats all.
and it is working fine with me. hope my little efforts can save a lot of time of others. apology for any typo mistakes and ready for any question and discussion.