Form configuration

  • Thread starter Marshall Harrison [OCS MVP]
  • Start date
M

Marshall Harrison [OCS MVP]

We have a form that a contractor developed for us but some of the form
variables are hard coded. For example the SharePoint URL is hard coded as
are the email address list. I've inherited all InfoPAth development and all
the hard coded stuff makes it difficult when moving form changes from DEV
to QA to Production.

Is there a way to have the form read an include or web.config file on form
load so that these variables are set properly. What I envision is a separate
config file for each of DEV, QA and PROD each with the appropriate values
for the environment. That way the form could be moved through the cycle
without have to make changes - simply keep separate configs.

Any suggestion will be appreciated.

--
Marshall Harrison
Microsoft MVP - Office Communications Server
Email: (e-mail address removed)
Web: www.GotSpeech.Net
Blog: http://gotspeech.net/blogs/marshallharrison/default.aspx
 
S

S.Y.M. Wong-A-Ton

You can create an XML file containing the configuration settings. Add this
file as a resource file to your form template (Tools > Resource Files). Then
create a data connection to the resource file (Tools > Data Connections > Add
Receive data > XML document > Resource files). You can now access this data
source from within the OnLoad event of your form (search the newsgroup for
code samples). To update your configuration file, go to Tools > Resource
Files, select the file, click on Export, modify it, then add it back again to
your form by replacing the old file.

Another option is to put the configuration file on one location that is
accessible by all users and then not include it in your form template. This
way you can update the configuration settings externally without having to
update the resource file in the form template itself. But again, users must
have access to the location of the config file.
 
M

Marshall Harrison [OCS MVP]

Thanks for the information.

Two quick questions.

1. If I place the file on the SharePoint server where the form is located
then will it be loaded properly by every user?
2. I assume the path would have to be fully qualified so that when the form
is run on the user's local machine the OnLoad event will find the file. Is
that correct?


--
Marshall Harrison
Microsoft MVP - Office Communications Server
Email: (e-mail address removed)
Web: www.GotSpeech.Net
Blog: http://gotspeech.net/blogs/marshallharrison/default.aspx
 
S

S.Y.M. Wong-A-Ton

1. Theoretically (because I haven't tested it), if every user has access to
the file on SharePoint and SharePoint itself has access to the data source,
then yes. I do not have a proper environment set up to test it for you, so
you'll have to give it a go and see if it works.
2. The path is always fully qualified. If you extract the form files and
search the manifest.xsf for dataObjects, you'll see an xmlFileAdapter with a
fileURL listed; there is where InfoPath gets the path from. You access the
data object by its name and not by its location from within the OnLoad event.
 
M

Marshall Harrison [OCS MVP]

Thanks.

I'll give all this a try later today.


S.Y.M. Wong-A-Ton said:
1. Theoretically (because I haven't tested it), if every user has access
to
the file on SharePoint and SharePoint itself has access to the data
source,
then yes. I do not have a proper environment set up to test it for you, so
you'll have to give it a go and see if it works.
2. The path is always fully qualified. If you extract the form files and
search the manifest.xsf for dataObjects, you'll see an xmlFileAdapter with
a
fileURL listed; there is where InfoPath gets the path from. You access the
data object by its name and not by its location from within the OnLoad
event.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top