maandag, januari 15, 2007

Handle the InfoPath Forms Services by yourself (in a Custom WebPart to view a web-enabled Infopath 2007 Form)

To understand this post well, please go through this post first:
- Hosting the InfoPath 2007 Form Editing Environment in a Custom Web Form

Sometimes you don't want to popup an error by InfoPath Forms Services (it will log this also in the EventLog), see image below. You want to catch the error in code and do some custom logging (or other stuff)

I will use the example when a dataconnection (webservices) in the form gives a time-out.

First keep in mind that we will bind the dataconnection-webservice to its control in code, so you have to deselect - Automatically retrieve data when form is opened (when adding a data-connection in InfoPath). Also don't forget to link the control with the dataconnection in infopath designer

What we gonna do in code:
- Add a handler that will get you into the Initialize methods of the XmlFormView
- Get the right dataconnection, execute it (so it will get the data and bind to the control)
- Add a "try/catch" block around this code

The code:

void viewform_Initialize(object sender, InitializeEventArgs e)
DataConnection dc = _viewform.XmlForm.DataSources["GetGAL"].QueryConnection;
catch (System.Net.WebException webEx)
//Log, ...
catch (Exception ex)
Logger.Log(ex, ...);

Some other InfoPath blogs:

woensdag, januari 10, 2007

Time-outs when using WebEnabled Infopath Form in Sharepoint 2007 WebParts

When you are using web-enabled infopath forms (that have dataconnections to webservices) in sharepoint 2007, you can get timeouts errors....

Example of an Time-out Exception:
Forms Services Runtime - Data Connections - TYPE: WARNING - EVENT 5566
The following query failed: GetSomething (User: MMMM\bbbbb, Form Name: formname, IP: , Request: http://serverZZZ/xxxx/yyyyy/composer.aspx?menu=3&Type=0, Form ID: urn:schemas-microsoft-com:office:infopath:xxxxxxx:-myXSD-2006-08-07T07-37-16, Type: DataAdapterException, Exception Message: The operation has timed outThe operation has timed out)

How to solve them?
  1. Check if your WebServices time-outs occur when you use the WebService directly (in a webbrowers), If so, you should change the timeout of the WebService in IIS Manager (InetMgr) or use more caching.

  2. If you are loading the Web-enabled InfoPath form into a custom webpart, you have to be sure that the following setting is used in the Form Library Advanced Settings page:
    Display as a Web Page (in stead of Open in the client application)

  3. Change the Data Connection Timeouts Settings. Open SharePoint 3.0 Central Administration: Goto Application Management > Configure InfoPath Forms Services
    Here you can change the Data Connection Timeouts Settings

Point 2 has fixed my problems...

maandag, januari 08, 2007

Problems starting VSTA in Infopath 2007 with Microsoft Office Server Sharepoint 2007 (.NET 3.0) installed *!!!FIXED!!!*

To fix the problem described below:

It worked for me when I did this:
uninstall .NET programmability support for .NET Framework version 2.0 and then reinstall it

(go to
Kristof his blog for full explanation)

When I want to add custom C# in an Infopath 2007 form, I get this error:

InfoPath cannot start Microsoft Visual Studio Tools for Applications.
To work with Visual Basic or C# code, Microsoft Visual Studio Tools for Applications (VSTA) is required. the Microsoft .NET Framework 2.0 and Microsoft Core XML Services 6.0 must be installed prior to installing VSTA. To install VSTA, open Add or Remove Programs, locate your 2007 Microsoft Office System installation, and then click Change

How should I make this work? Reinstalling some things? I think the .NET 3.0 will cause the problems....

This stuff is installed:

  • Microsoft .NET Compact Framework 1.0 SP3 Developer
  • Microsoft .NET Compact Framework 2.0
  • Microsoft .NET Framework 2.0
  • Microsoft .NET Framework 3.0
  • Microsoft Office Enterprise 2007
  • Microsoft Office Sharepoint Designer 2007
  • Microsoft Office Sharepoint Server 2007
  • Microsoft Visual Studio 2005 Professional Edition
  • Microsoft Visual Studio 2005 Team Explorer
  • Microsoft Visual Studio 2005 Tools for Office Runtime
  • Windows Server 2003 Service Pack 1
  • Regarding Workflow:
    Enterprise Content Management Starter Kit for 2007 Office System (beta 2 tr)
When I want to re-installing MSXML 6.0 I get this error:

Installation of MSXML 6.0 Parser failed because a higher version already exists on the machine. To proceed uninstall the higher version and then run MSXML 6.0 Parser Setup again

Kristof De Causemaeker add some more comments:
When you want to create an InfoPath Add-in project via VSTO, it also give errors...
I thinks that VSTO/VSTA in combination with .NET 3.0 and InfoPath 2007 will not work yet..... Maybe a Windows Registry problem?

maandag, januari 01, 2007

Welcome To 2007!

Happy New Year and welcome to the Year of Bond, James Bond ;-)