Get InfoPath to Preview VSTO and VSTA Projects
Page 1 of 7
Written by
Gregory Scot Collins
Friday, 29 February 2008, 5:08 AM
This article has been tested to work with the following products and versions. No guarantee of compatibility, with or without modification, is offered for products or versions other than those listed.
- InfoPath 2007 and 2003 (Microsoft)
- Internet Explorer 7 (Microsoft)
- Office 2007 and 2003 (Microsoft)
- Office InfoPath 2003 Toolkit for Visual Studio .NET 1.0 (Microsoft)
- Visual Studio 2005 and 2003 (Microsoft)
- Visual Studio Tools for Applications 2005 (Microsoft)
- Visual Studio Tools for Office 2005 and 2005 SE (Microsoft)
- Windows XP and Vista (Microsoft)
IN THIS ARTICLE:
- The issue
- Domains and security zones
- Three solutions
- Solution 1: The workaround
- Solution 2: The per-user solution
- Solution 3: The per-form solution
- Make sure the intended domain is listed in the Local Intranet Websites
- Specify the preview domain in your InfoPath project form options
- The story behind the solution
- My first encounter with the issue
- Seeking aid and support
- Somehow preview started working
- Windows Update breaks it
- Installation discs
- The new laptop
- The breaking update
- What didn't work
- A new desktop computer and Windows Easy Transfer
- Tracking it down to a registry issue
- I finally find the cause
- The local intranet flags
- Intranet and Internet zones
- Conclusion
The issue
While attempting to preview a Visual Studio Tools for Office (VSTO) or Visual Studio Tools for Applications (VSTA) InfoPath project you might get a rather unhelpful error message telling you that "InfoPath cannot open the selected form," as shown in Screenshot 1. If this can occurs for a brand new, freshly created managed code project, but does not occur with a codeless or script-based form, then you need to read on.
The lack of preview capabilities while building an InfoPath form template can be extremely aggravating. Preview is essential to the development workflow allowing you to quickly test changes and progress.
There are various reasons you could receive this error message. You will see it if you attempt to preview a form that is already being previewed. I have, on occasion, received this message for a form template that was previewing just fine moments before, and then stopped after some changes I made—an issue for which I still have not found a reason. However, this article is not about those scenarios, but rather the scenario where you can never preview a managed code project, even a brand new, freshly created, blank one.
Domains and security zones
The error stems from security issues due to being part of a workgroup rather than being joined to a domain. Any machine joined to a domain will not experience this issue because it has a detectable intranet while machines that are part of a workgroup don't, and therefore can experience the issue.
InfoPath uses the Windows Internet (WinINet) application programming interface (API) to define many of its security settings and subsequently depends heavily on Internet Explorer settings. When not joined to a domain, an intranet is not detected and the InfoPath form is opened in the more restrictive Internet zone rather than the Intranet zone. Because it is considered a more controlled environment, security settings for the Intranet zone are less restrictive. Forms with managed code (i.e. VSTO and VSTA projects) are, by default, not allowed to open in the Internet zone, effectively disabling your ability to preview your form template.


Stumble It!
Digg It!
del.icio.us




