11/03/2007

InfoPath: Forcing a form to open from SharePoint into a browser

If you are using MOSS Enterprise Edition or you have installed InfoPath Forms Server with your WSS 3.0 or MOSS Standard Edition then your users can fill out InfoPath forms using a browser... IF... they have do not have the InfoPath program installed on their local PC.

If they do have InfoPath installed then SharePoint will open the form in InfoPath. (How does it know? See here.) Of course before any browser related features will work, you must set the correct options in InfoPath when you design and publish the form:
  • Select: Tools, Form Options, Compatibility, Design a form template that can be opened in a browser or InfoPath
  • And when you publish: you must checkmark "Enable this form to be filled out by using a browser"

Microsoft has an MSDN article on this topic. Three of their examples are for opening an existing form and one is for creating a new form, but I had to make one change to make it work.

Here is their article: How to: Use Query Parameters to Invoke Browser-Enabled InfoPath Forms http://msdn2.microsoft.com/en-us/library/ms772417.aspx

Here is their example (scroll down to "Using a URL with the XsnLocation, SaveLocation, and Source parameters"):

http://ServerName/sites/SiteCollection/_layouts/FormServer.aspx?XsnLocation=~sitecollection/FormLibrary/Forms/template.xsn&SaveLocation=~sitecollection/FormLibrary&Source=~sitecollection/FormLibrary

(replace servername, sitecollection and formlibrary with your path to the library with the form)

This example just prompted me to save or open (in InfoPath) the form. To get it to open in a browser you must add &OpenIn=Browser to the end of the URL. Here is what I got to work:

http://ServerName/sites/SiteCollection/_layouts/FormServer.aspx?XsnLocation=~sitecollection/FormLibrary/Forms/template.xsn&SaveLocation=~sitecollection/FormLibrary&Source=~sitecollection/FormLibrary&OpenIn=Browser

Now only two problems to solve:
1) The NEW menu still opens the form in InfoPath. I have to list the above link somewhere on the site so users can always create a form in their browser.
2) This only seems to work on form templates stored in a forms library and not with a form published as a Content Type.

.

No comments:

Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.