Forms Services 2007 => 2010 migration tip
Hi,
Recently, I've been involved in migrating InfoPath web browser 2007 electronic forms to a SharePoint 2010 forms server.
Although, most of the forms work "as is", I lost a bit of time on a specific form since I kept getting the following error:
Value does not fall within the expected range.. Type: System.ArgumentException. StackTrace:
at Microsoft.SharePoint.SPWeb.GetFile(String strUrl)
at Microsoft.Office.InfoPath.Server.SolutionLifetime.DataAdapterSharepointListQuery.<>c__DisplayClass23.
at Microsoft.Office.InfoPath.Server.SolutionLifetime.DataAdapterUtil.Impersonate(DataAdapterInformation adapterInfo, String userName,
String userDomain, String password, CodeToRunUnderImpersonation codeToRun)
at Microsoft.Office.InfoPath.Server.SolutionLifetime.DataAdapterUtil.Impersonate(
DataAdapterInformation adapterInfo, String userName, String password, CodeToRunUnderImpersonation codeToRun)
Usually, this error tends to indicate that something points to a non-existing object so I first inspected the content type, the list fields etc...but everything was ok. After a while, I noticed that the problem was caused by a secondary data connection on the list to which the form was deployed with the option Include data for the active form only. This enables the form to retrieve list fields that do not especially belong to the main datasource.
So, I noticed that preventing this connection from triggering "fixed" the problem but of course, I needed this connection. It turned out that I had to convert this connection using the button Convert to current version.
Before doing that, I also needed to convert the entire form to the current version. I didn't realize it was needed since all my other forms were working fine...
After that, just to confirm that this can be a problem, I created a new blank form, made a secondary connection with the option to include data only for the active form, I converted it to previous version, published the form and indeed, the error got thrown again.
Morality, this might sound obvious but I lost a few hours trying to figure out what was the culprit and google/bing didn't help me much. I just saw that convert button by chance and suddenly everything became clear :).
Hope this helps!
Happy Coding!
Comments
Thanks Man
Thanks for posting this valuable idea, but I did not understood some point, did you mean "Convert to current version" that you upgraded the project to visual studio 2010, I created the form template using VS 2008
version
Hi,
In the form template itself, if you have data connections, you have to convert them to the 2010 format. To be able to do that, you also have to convert the form. In my post, I was talking of forms designed directly with InfoPath Designer, not forms designed with Visual Studio. If my memory is good, it's not possible with VS 2010 to have InfoPath Project templates anymore (double-check it).
So, your way to go would be to use InfoPath Designer, convert it and then push it back to VS if you embedded your form in a .WSP.
Best Regards
It helped
Thanks so much, I was about to pull my hair out over this!
- Jen
Great
Hi,
Great to hear and trust me, I have no more hair now :).
Cheers