InfoPath Basics: InfoPath Resource Files - purpose and benefit
Learn what InfoPath resource files are and when you should use them.
A heavily underused and probably misunderstood feature of InfoPath is the concept of resource files.
This is the description of an InfoPath resource file - directly quoted from Office Online:
A resource file is a file that is used to display additional information in a form template. When you save or publish a form template, any resource files are included in the form template.
The main thing to remember about resource files in InfoPath is that they are stored within the InfoPath form template itself.
And a major benefit of this is that you can move an InfoPath form template from computer to computer without having to worry that you’re breaking InfoPath data connections.
A best practice is to use InfoPath resource files whenever you have external files your InfoPath forms need to access. By adding such files as InfoPath resource files, you remove the dependency of needing access to external locations, which may become unavailable from time to time.
You can add resource files directly to an InfoPath form template via the Tools > Resource Files menu option in InfoPath 2007 or via Data > Form Data > Resource Files in InfoPath 2010, but you can also have InfoPath automatically add a resource file for you when you select certain options when creating an InfoPath data connection to an external file.
For example, you can create a Receive data connection to an XML file and tell InfoPath to access the XML file from a location on disk and not to store a copy of the data in the form template. When you do this, a resource file will not be created and stored within the InfoPath form template.
But you can also tell InfoPath to include the data in the InfoPath form template upon which InfoPath will include it as a resource file.
The best way to see how InfoPath stores resource files is to create a data connection to an XML file that is located somewhere on disk, accept all of the default options which are presented to you in the Data Connection Wizard, and then go to Tools > Resource Files in InfoPath 2007 or to Data > Form Data > Resource Files in InfoPath 2010 to see that a resource file has been automatically created for you.
You can then verify that a resource file is indeed part of an InfoPath form template by extracting the InfoPath form template files via the File > Save As Source Files menu option in InfoPath 2007 or via File > Publish > Export Source Files in InfoPath 2010.
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.