Beginners programming for InfoPath browser forms in SharePoint
You only need to know how to do 3 things to be able to start writing code for InfoPath browser form templates that you deploy to SharePoint. Learn what these 3 things are.
As you may already know, if the out-of-the-box functionality of InfoPath does not satisfy your requirements, you can write code for the functionality you require.
While you can use Visual Studio Tools for Applications (VSTA) to write code for InfoPath forms that run both in the InfoPath client application and a browser, VSTA is less suitable for debugging code in InfoPath browser forms.
To be able to debug .NET code in an InfoPath browser form, you’ve got to have the ability to attach to the worker process of the SharePoint site to which the form template has been deployed.
And since VSTA does not have an option to attach to a process when debugging, you must use Visual Studio instead to create and thereafter debug InfoPath browser forms.
I’d like to highlight the following 3 videos, which can help you get started with writing .NET code for InfoPath browser forms that you deploy to SharePoint:
- Write code for InfoPath 2007 in Visual Studio 2005
This video shows you how to create an InfoPath form template in Visual Studio and write simple code to set the value of a field.
- Deploy an InfoPath browser form with managed code to SharePoint
This video shows you the steps and process you’ve got to go through when deploying an InfoPath browser-compatible form template with code to SharePoint.
- Debug code of an InfoPath browser form in SharePoint
This video shows you how to find the worker process of a SharePoint site, attach the debugger to this process, and then start debugging an InfoPath browser form.
If you don’t have a choice but to use VSTA to write and debug code in an InfoPath browser form, so you do not have access to Visual Studio, you can always write messages to the Windows Event Log or a file on the SharePoint server, so that you still have the ability to track issues within an InfoPath browser form. It is not an ideal method, but it works.
Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent of S.Y.M. Wong-A-Ton. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author, S.Y.M. Wong-A-Ton.