.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

InternalStartup method erro when publish InfoPath form with custom code

Posted By:      Posted Date: October 11, 2010    Points: 0   Category :SharePoint

Hi All,

I created a SharePoint Form Library, and added a button in the form. Then, by following the steps of adding custom code. I was trying to add codes to the button click event in VSTA. When I try to publish this form to my SharePoint library, I got an error message say:

"The form template has been published to the server but it can only be opened in InfoPath Filler.

There is an error in the InternalStartup method of form code.

There may be additional error detials in the Design Checker task pane."

However, I did not make any changes to the InternalStartup. and then I tried to create another SharePoint Form Library Form in InfoPath Designer, and just add click event, but did not input any code, I got the same error. So I believe this is caused by either environment or the configuration of SharePoint Server. Could anyone help me out? Thanks!

View Complete Post

More Related Resource Links

Infopath form return XMl code during workflow task


1.     Review 7777.xml.

2.     Perform the specific activities required for this task.

Use the Edit this task button to mark the task as completed. (If you cannot update this task, you might not have access to it. Click here to request access.

Extracting Infopath form templates (with code behind) from a farm



I am in the middle of a migration of MOSS 2007 on server 2003 R2 to server 2008 r2, to be in the position to migrate to SP 2010. I am trying to extract form templates (with code-behind) from the old farm to the new farm. I did not set this farm up myself, so I would have copies of everything that was deployed to the farm, but now I don't. I have tried grabbing the .xsn from the Form Templates form library, and the form comes over, but no code behind, it says, The VB or C# project for this form template cannot be found. I have also tried extracting the solution files, and changing the file ext to .cab and opening the file up, only to find nothing very useful.

I need to extract and open the code up because I believe one of the forms that sends emails dynamically, is pointing to an old exchange server, because the emails are not getting through, and the exchange server was recently changed.

Any ideas would be much appreciated.


Infopath button click event in custom workflow code.


Hi All,

I have designed the infopath form(Init) and integrated with my state machine workflow. i want to access button click event (designed in Infopath form) in my workflow code.

Can you help me.




Best way to Deploy InfoPath form with connection information and managed code

Hi, Whats the best way to deploy an InfoPath form with connection information and managed code. Is there way I can create a deployment package for this? Thanks in advance, San

Adding a custom form to List's FormCollection in code

Hello, In a site within a site collection, using SharePoint Designer 2010 we have created custom Display, Edit and View forms and assigned them to the Item content type of a custom list as it's default forms. When looking at the Forms property of the list, I can see all six forms listed: the three original forms (DispForm.aspx, EditForm.aspx, NewForm.aspx) and the three custom forms (displayifs.aspx, editifs.aspx, newifs.aspx). Each site in the site collection has this custom list and I want to add these three custom forms to the custom list in each site in the collection as the default forms for items. In code I have tried copying the files from the Item subfolder of the first custom list to the Item subfolder in each list in each site, and then setting the properties for the Item content type's default forms to point to these new files (e.g DisplayFormUrl = "~list/Item/displayifs.aspx"; EditFormUrl = "~list/Item/editifs.aspx"; NewFormUrl = "~list/Item/newifs.aspx";) and I have also copied the fourth file template.asxn to this folder in each list. However, I have not found how to add these new files to the Forms property of the list iteself, as this property is read-only. It still only contains the three default forms. Is this possible to do in code? When I try to open the Display form or Edit form in

Invalid URL error on InfoPath Form Publish on an External List

I am using SP2010 Enterprise on Windows 7 and SPD 2010 & InfoPath 2010 all on the same machine in test.  I create an External List based on a ECT and Click on the 'Design Forms in InfoPath' icon and 'Item' which drops down from it.  That launches InfoPath Designer 2010 & downloads the form from http://<site>/lists/<mylistname>/Item/template.xsn and sets you up in an edit session.  I can make changes on the form but when I publish via File | Publish | External List (Publish Form To An External List) I get a save prompt for local copy & then an error: The following URL is not valid: http://<site>/lists/<mylistname>/Item/template.xsn  (same URL as it started with during the initial download). I took screen shots of the messages to make sure. Some things I have tried & observations: If I change to an internal Custom List the publish step (to list not external of course) works just fine. I also ran this test launching SPD as Administrator with no difference.  I stopped the System Event Notification service per http://serena-yeoh.blogspot.com/2006/08/infopathformurlnotvalid.html  'net stop sens' with no difference Any ideas are welcome. BTW I notice that this step of launching the InfoPath designer does change the form on the list in Sharepoint albeit slightly -

Cannot publish InfoPath 2010 form template to SharePoint Server 2010 RC

Hi all, I am MSFT in Vietnam. I created a SharePoint list using InfoPath 2010 RTM 64bit. After publishing it to SharePoint 2010 RC, I see an error message:  Click on button "Show Details" the message is The list schema does not match the schema of this form. Refresh the data source and publish the form again. When I create new item based on published SharePoint list, I can see plain form not browser enabled InfoPath form. I checked InfoPath Form Services, everything seems to be good. What should I do to publish SharePoint list from InfoPath 2010 to SharePoint 2010 as browser enabled form?

Add a New Item to a Custom Sharepoint List and Sharepoint Calendar from one Infopath form.


I am trying to create an infopath form for requesting time off.  Once the request is approved I want the form to add the event to a calendar on sharepoint.  I was able to do this using the article by S.Y.M. Wong-A-Ton at http://www.bizsupportonline.net/infopath2007/programmatically-add-item-sharepoint-calendar-infopath.htm.  But I want the form to also add an item to a custom list that has the employees available time off stored on it.  That way the form can automatically subtract the time entered on the infopath form from what is available on the custom list.  I was able to do this using another article by S.Y.M. Wong-A-Ton at  http://www.bizsupportonline.net/infopath2007/programmatically-add-rich-text-item-sharepoint-list-infopath.htm.  I can make both of these functions happen seperately but I need them to happen on the same Infopath form.  I am using Infopath and MOSS 2007.  I have tried to use 2 CAML receive data files and I treid to co

publish infopath form to sharepoint services 3.0 as content type



can an infopath form be published as content type to a sharepoint services 3.0 form library?

i have created 2 form libraries. one to store the tamplate an the other to store the form itself and where you can open a new form.

but whenever i click new to open a new form i get this error message:

the element "comment" is used but not declared in the DTD/schema.

does any one know what this error could be?

Deploy Infopath form for Custom list


I used customise form option in custom list ribbon menu, and customised the form in Infopath. I used publish option from Infopath its sucessfully reflected in SharePoint site. I have new data connections as well.

Now I ve to deploy the same in Production machine, I have to give script or wsp to the admin guy. Any pointers.

InfoPath error: One or more required custom controls in this form cannot be created


I have an InfoPath 2007 form published to a form library in MOSS 2007.  This form opens in InfoPath and is not browser-enabled.

The form suddenly stopped working for me and 1 other user.  I'm a farm admin and the user only has contributor rights on the form library (and site and subsite).  Everyone else with appropriate permissions can access existing forms that use the template and can create new forms using the template.

When either one of us tries to open the form, we get:

InfoPath cannot open the following file: http://site/subsite/formlibrary/filename.xml?OpenIn=PreferClient&NoRedirect=true&XmlLocation=/subsite/formlibrary/filename.xml.
One or more required custom controls in this form cannot be created.

No errors in the web front end event log or SharePoint log files.  No errors in my client PC's event log.

I've tried the following without success:

Opening the template and publishing it to a new list. 
Published the template to a new content type on this list and a new list. 
Dumped IE cache and reset IE settings.
Rebooted the computer.
Checked permissions on the list to make sure they were correct.

Last change made to the farm:

I performed the work around change to the web

Get ListItemID in code behind an InfoPath Form


I have a few cases where I'm using an InfoPath form in a SharePoint list (for instance, as the default content type, so that clicking "New" in a Document Library opens an InfoPath form in the browser).

In the form's code-behind I would like to programmatically create a new item in another list, setting a Lookup Field's value there to the ListItemID of the item associated with the open InfoPath form. But I can't find any way to identify the ListItemID (or GUID) of the InfoPath form.

Does anyone know how to get the ListItemID of an InfoPath form in a SharePoint list, from within the InfoPath form's code-behind?


Creating a Custom List Definition that uses InfoPath Form



I have created a custom list definition in Visual Studio 2010.  By default it is using the out of the box "pages\form.aspx" for the New/Edit/Display form rendering. 

I am just wondering if it is possible to use an InfoPath form as default for the New/Edit/Display form?

I have tried to create a custom list with custom info path form thru the UI, and export the site as WSP.  I have analysed the files and notice a few things:

1.) I need to add a XmlDocument section in the Schema.xml for displayifs/editifs/newifs.aspx

2.) I need to provision the xsn in "Lists/{List Name}/Item"

3.) I need to provision the *ifs.aspx in "Lists/{List Name}/Item"

As you see, some of the settings required the {List Name}.  That's mean I can't really create a list definition that is reusable because I need to know the List Name before hand. Is there any way to specify the path with some kind of variable instead of static list name?

Furthermore, I notice that the "Developer" tab is missing from the Ribbon when I modify form, hence I can do any code behind.  Is this a limitation, or is there a workaround?



Wilson | SharePoint Egg's Blog

Get Infopath form URL from code C#



I need to include a hyperlink on the print view of an Infopath form. Now this is all good.

The problem is that the form does not close when submitted and then gets emailed to where it needs to go, so the url does not refresh. What I have done is to request the url:

XPathNavigator xnMyForm = this.CreateNavigator();
      XmlNamespaceManager ns = this.NamespaceManager;

      string strURL = HttpContext.Current.Request.Url.ToString();
      xnMyForm.SelectSingleNode("/my:myFields/my:secHidden/my:txtURL", ns).SetValue(strURL);

And then I set the hyperlink to the txtURL datasource.

So what happens is that when the email is sent without closing the form and reopening it and clicking on the hyperlink, I just get a new blank form. Only when I close the form and reopen it do I get the form that was submitted.

How can I get the datasource to refresh with the new url that is created for the specific saved form? Is there a place where it is saved? I have checked in the xml source of the saved form but I cannot see anything there..!

InfoPath list form publish issue when URL changes



We have a problem with publishing SharePoint InfoPath List Forms when site's or some top level site's URL is changed. After someone changes the URL that change does not affect to the InfoPath list form's publish URL value and you are not able to publish the form anymore. I got the following error message and if I change the URL back what it was before then publish works fine again. I don't know is this a feature or bug but does someone know is it possible to somehow update the publish URL to the form so that the possible site URL changes won't break the form publishing? 

The SOAP response indicates that an error occurred on the server:

Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.
<detail><errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">There is no Web named "/sites/......./_vti_bin/Lists.asmx".</errorstring></detail>



Infopath form timesheet question on rounding time and using code


We have a timesheet form that has 4 time fields:  Start Time, End Time, Actual Time and Billable Time. 

Our Start Time, End Time and Actual Time buttons and field calculations work just fine, but we want the 4th field to calculate the billable time by rounding UP to the quarter-hour.

For example:

Start Time - 9:00am

End Time - 11:20am

Actual Time -  2:20

Billable Time - 2:30 (or 2h30min)


I'm new to Infopath and not sure how we would accomplish this.  What type of code would I need and can I even use code on that Billable Time field to accomplish this?


Thanks for any help you can give me!


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?

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