Uncategorized

Insert, Update to SharePoint List and Published InfoPath2010 Form to SharePoint Server


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.

First We need to Design the InfoPath Form, during this step we need to consider some important steps.Image

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.

Image

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 Image

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.

Image

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.

Image

Now select Security and Trust , option and marked as Full trust , below screen shot.

Image

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.Image

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.

Image

Image

now after this wizard save the xsn file to your local hard drive. this .xsn we will upload and will deploy.

Image

now do the next next and published it.

Image

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.

Image

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.

Image

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.

Creating Content Type So that it will be come to Info path webpart. Select Parent as Microsoft Infopath

Creating Content Type So that it will be come to Info path webpart. Select Parent as Microsoft Info path

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.

Image

once we scroll down

now Image

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.

Crate new webpart page and select the info path viewer webpart. go to the edit web part and select the newly created library, and content type. Image

click ok and apply.Image

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.

Standard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s