in

InfoPath Dev

David Airapetyan

May 2007 - Posts

  • Developing IP2003-compatible forms in IP2007

    So you have finally upgraded to the latest and greatest Office 2007. Wonderful! You can now design and deploy the new shiny InfoPath 2007 solutions along with the ability to publish to the Forms Server! But there is a problem – your friends at the university who are using the beautiful workflow solution you have developed for them are still using InfoPath 2003. Now that they have asked you for a new feature, what do you do?

    One option would be to have both InfoPath 2003 and InfoPath 2007 (if you can, use two different machines because side-by-side might cause problems especially if you are writing code). However, there is a better solution! It turns out that InfoPath 2007 can let you develop and save solutions in IP2003 format. Now, let’s talk about migration.

    1. You have developed your InfoPath 2003 solution without using code or you have used JavaScript. There is nothing to do – just open your solution in InfoPath 2007 Designer and everything will work.

    2. You have developed your InfoPath 2003 solution with .NET business logic using either the VS.NET or VS2005 InfoPath toolkit. Things get a bit trickier here. InfoPath 2007 is supposed to be able to migrate those for you automatically but I had many problems getting this to work. Here are some good workarounds to get you going:

    2a. You do not have Visual Studio installed. In this case, your only option of developing InfoPath business logic with .NET is to use the built-in Visual Studio Tools for Applications (aka VSTA). Here is how you can manually migrate your code:

    - Open your form in the 2007 Designer

    - Select Tools | Form Options – Programming and click "remove code"

    - In the "Form Template Code Language", select C# (InfoPath 2003 compatible ) – or VB, if you’d like

    - Tools | Programming – Visual Studio Tools for Applications

    After it has generated a new FormCode for you, copy-paste your code over (you might need to re-create all the handlers)

    Voila! Now you can design and develop in IP2007, write business logic and once you deploy the solution, it will work on both IP2007 and IP2003.

    Note that VSTA is not as rich of an environment as the full-blown Visual Studio so there will be some things you won’t be able to do such as having multiple projects in your solution.

    2b. You have Visual Studio 2005 installed. This is good news! You can now take full advantage of VS2005 with Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System (VSTO 2005 SE) available for download at this address: http://www.microsoft.com/downloads/details.aspx?FamilyId=5E86CAB3-6FD6-4955-B979-E1676DB6B3CB&displaylang=en

    Here are the migration steps here:

    - In Visual Studio, File | New Project

    - Select Office | InfoPath Form Template, click OK

    - The InfoPath 2007 Designer dashboard comes up. Select you existing form by clicking "On My Computer" under "Create project from existing form template"

    - This will copy the original form into a new location (the one you have specified when creating the project) without affecting your original solution

    - When you clone a solution this way, InfoPath 2007-based FormCode is automatically added to your code. You don’t want this, so the code has to be replaced:

    - Select Tools | Form Options – Programming and click "remove code"

    - In the "Form Template Code Language", select C# (InfoPath 2003 compatible ) – or VB, if you’d like

    - In the solution explorer, open FormCode.cs (or the VB equivalent) and paste your original code in there.

    - Open the manifest in Visual Studio and navigate to the Insert | On Load Event method via Visual Studio menus to ensure InfoPath re-creates the solution DLLs.

    You’re ready to go!

Copyright © 2003-2007 Qdabra Software. All rights reserved.
View our Terms of Use.