.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Programmatically create an InfoPath form

Posted By:      Posted Date: August 26, 2010    Points: 0   Category :SharePoint

I'm programmatically creating an InfoPath form using this article: http://www.bizsupportonline.net/infopath2007/programmatically-create-infopath-form-console-app.htm.


Everything works well up to 29 fields (my:field1 ... my:field29). After that it runs without an error and posts a form to the library however the icon does not switch to an infopath icon and the filename stays blanks. I don't believe this field specific, it seems to be happening when I use any 29 to 30 fields so I'm thinking its a memory issue with the stream reader.

Has anybody every had this issue before, is there a way to fix this?


View Complete Post

More Related Resource Links

How to Create Auto increment Request number for browser enable infopath form field Programmatically?

hi all,

i have created an infopath which have one request no. field and it will auto increment when click on add new item on sharepoint Document library

field contains (highest value of column request no. +1 )  when infopath will open in browser.

What i have done on this:i have create new data connection on sharepoint library and then pick document library then choose ID field and insert function in the field max(ID)+1.

help me



InfoPath form checked out so 'on create' workflow not being started


Hi all,


I have found a couple of threads asking for advice on how to check in an InfoPath form when it’s saved or submitted to a forms library. The reason for doing this is so a workflow can start based on a new item being created in that library, and so it doesn’t just sit there with a “Starting” status.


The answers I have found contradict each other:

·         You have to do it with a workflow.  This can be done easily with SharePoint Designer if that's an option for you. Source:

Create approval in infopath form


Hi, i am currently doing approvals by submitting an infopath form and creating a task for a user.

I would like to create an approval system that can be done all from within the infopath form.  An approver would receive an email with a link to the infopath form.  From there they would be able to view the form and approve there in the infopath form services web form.

Does anyone know how I can accomplish this?

How to redirect Infopath form programmatically on button click


I am having an issue with infoPath Forms and C#, 
I have a 1st form open to the user, and when he click a button it opens a 2nd form.

Sounds pretty easy, but I have tried many ways and still error.
(environment is InfoPath Forms 2007 in Sharepoint and code: C#)

this is what I have:
- form1 . a text field where I enter the URL of form2
            . a button with code below

The issue is that if I type the URL of form2 
 in the text field and press the button I get this error
"Critical Error : An error occurred submitting this form to the Web server. The form will now be closed."

But instead of the URL of form2.xsn I type http://www.google.com/ they it works (w

create an infopath form that receive and submit data to sql server database in the same form



i want to create an infopath form that can receive the data out of the slq server database and edit the data in the database and then submit it.

here is what i did so far.

i created a data connection to a sql server database to SUBMIT the data.

also i created a data connection to the same sql server database to RECEIVE the data.

when i open the form the user and the user's details are already filled in the form, now i need to let the user edit the data in the fields or add a new data in a field and then the form need to be submitted to a temporary database to be checked first by an approver and after approval the form must be submitted to the real sql server database.

i tought about that the approver just need to click a button and the data will be submitted to the the real database.

both the temporary and the real database has the same tables and fields.

i just need to know how to edit and submit the data to the temporary later to the real database



Programmatically Mapping Custom SharePoint Column on Non-browser Enabled InfoPath Form


I have an InfoPath form, which, due to control requirements, is not browser enabled. It is being programmatically added as a content type to SharePoint (MOSS 2007). All users have Office 2007 installed so they will be able to open the form. I also have a custom multi-line column in the SharePoint document library. I can manually publish the form and map the column to a field of the form, but I need to be able to do this programmatically.

We are currently deploying the forms by modifying the publish url in the xsf during install. We have tried to modify the site coulmn GUID in the template xsf during install without success.

Does anyone have any ideas as to how we can programmatically promote the InfoPath field so it is visible in SharePoint?

Retrieve the list ID of a programmatically-submitted infopath form

I'm using the DataConnections["SUBMIT"].Execute() method to submit my InfoPath form to a document library.  However, later in the custom code I need to reference back to the submitted form (I need the ID and the title).  Is there a way to gather this information while submitting?

Using SharePoint designer to create a new infopath form



I've got an infopath formula that should trigger off the creation of a second infpath formula populated with some of the fields from the orgininal form via a SharePoint Designer workflow.  I set the correct content type and everythinf is ok - except that the form created via the workflow has an xsn extension and not an xml extension and therefore opens in the infopath client and not IE.

I knew about this problem with SPD 2007, and the workaround to put an empty xml version of the form as a content type - but can anyone confirm that this is still necessary in 2010 ?

Thanks for your help


How to create a workflow that submit an infopath form to a library of a specific user



can someone help me with this?

i'm using wss 3.0 and infopath 2007.

i have a form that need to be approved by a specific approver.

first when the user submit the form it send an email to the specific approver and the form is also submitted to a library.

so the approver gets an email and the approver need to get the form submitted to his library.

the email part is working fine. now i miss the library part.

i think i need to use a workflow. but how can i create a workflow that assinged a to-do item to a specific approver instead of a group.

in my library i have the following fields:

form name, created by and aprrover's name.

now i need the workflow to look up for the name of the approver and send an "assigned a to-do item" to the specific approver of the form

can someone help me with this?

dynamically create a checkbox inside the infopath form?


I have a shared database that drives Windows Mobile Apps, Windows WPF Clients and now rich client InfoPath form (this wont be used an InfoPath web, only the rich office client)...

This database contains a list of daily changing of Audit Questions depending on the week and season etc.

I want to make a call to the database from InfoPath, pull back a list of LabelName and Controltype_id  1=checkbox 2 = textbox

In the Onload Event of the InfoPath form I want to dynamically create Textbox/Checkboxs with the label names from the database, with an question_id per answer.  Then the user will disconnect their internet and drive to the place without service (large metal multiroom coolstores without 3G service)  and fill in the checklist, the the user presses a button, and it evaluates all the answers and makes the background colour grey or black, and change the font colour to white. then the user presses the submit it back to the server when they are back in 3G service again.  

How can this be acheived? can someone send me some example code that works, thanks.

Please dont reply with "this is not possible", make the impossible possible.
1,000s of people told me I couldn't get barcodes into InfoPath even with the cursor on any form field. But I did it.
10,000s of people to

Create an Infopath form to generate unique number MOSS 2007


I created an infopath form that would auto generate a number to each form from following instructions at the following site.




I am wondering if it is possible to change the starting point of the ID field within sharepoint.  It starts at 1.  I would like it to start at 1000. and add 1 number each time a new infopath form is added. Or would I add a different field to accomplish this.

Quick way to create a custom form with InfoPath


Hello! I'm using MOSS 2007 and I am only able to use SharePoint Designer and the browser to build forms and to perform site admin (Federal Agency security).

We've got a list for which we want to make a custom form. I've found tutotials that show me how to connect InfoPath with a SharePoint list via webservice. However, I'm wondering if there's an easier way to create a form in a form library and connect it to a list so that it can send data to the list.



InfoPath form submission error: You do not have permission to create a file in this location.


I have created an InfoPath 2007 form and published it to a SharePoint 2007 site. We use active directory authentication. The library has contribute rights for all authenticated users. The site itself has restricted read for all authenticated users (so they don't see the site actions button). An employee can open the form (locally in InfoPath), but when they click submit the authentication window pops up. Putting in credentials does nothing. Clicking cancel gives this error:


InfoPath cannot submit the form.
Some rules were not applied.
An error occurred while the form was being submitted.
The form cannot be submitted to the following location: ....... (path to library)
You do not have permission to create a file in this location.

Does anyone have a solution to this issue?


Is a Site that contains multiple Lists where the list should be able to create an InfoPath Form(form


I guess what I'm asking is, is this possible?

I have a System that I'm trying to implement in SharePoint. It basically is a Site that contains multiple Lists. The list should be able to create an InfoPath Form(form1). Then I need to create multiple InfoPath forms(form2) that is basically a sub-form of form1. Form2 will have its own List containing only form2's that relate to form1. Then create sub-form(form3) to form2.

Using a combination of InfoPath and SharePoint is this possible?

form feild hints are not displaying for textboxses inside create user wizard?



I'm using following JS code to display input hint box besides the textbox whenever that asp.net textbox receives focus. 

I'm doing this for a registration form and all of the textboxes are inside the asp.net create user wizard control.

<script type="text/javascript">
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {

function prepareInputsForHints() {
	var inputs = document.getElementsByTagName("TextBox");
	for (var i=0; i<inputs.length; i++){
		// test to see if the hint span exists first
		if (inputs[i].parentNode.getElementsByTagName("span")[0]) {
			// the span exists!  on focus, show the hint
			inputs[i].onfocus = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
			// when the cursor moves away from the field, hide the hint
			inputs[i].onblur = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "none";

Form Filler: Build Workflows to Capture Data and Create Documents


Learn how to create a workflow that uses InfoPath forms and other office documents for passing data to targeted activities and for use in Office documents.

Rick Spiewak

MSDN Magazine June 2008

InfoPath 2007: Designing Form Templates With The New Features Of InfoPath


InfoPath 2007 is an XML forms designer and editor, and a fully featured and integrated member of the Office family. This article takes a sneak peek at some of its new features.

Scott Roberts and Hagen Green

MSDN Magazine August 2006

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend