Showing posts with label InfoPath. Show all posts
Showing posts with label InfoPath. Show all posts

Wednesday, January 6, 2010

Anonymous access to browser-enabled InfoPath forms in Sharepoint

Some time ago I needed to turn on anonymous access to InfoPath forms in Sharepoint. There were several requirements for the forms:

  • forms should be browser-enabled after provisioning
  • forms are provisioned in custom document library not in root site
  • forms should be available for anonymous users after provisioning

First problem was to make InfoPath form which located in custom doclib (i.e. doclib which created using custom ListTemplate.xml and custom Schema.xml) browser-enabled. In order to do this several steps should be performed:

  1. Configure .xsn form to turn on browser compatibility. In InfoPath application open menu “Tools –> Form options –> Compatibility” and check “Design a form template that can be opened in a browser or InfoPath”
  2. Configure doclib. Open and doclibe “Settings –> Advanced Settings” and check “Display as a Web page”. If you want to specify it during provisioning to need to add DefaultItemOpen=”1” attribute in <List> tag in Schema.xml:
  3.    1: <List ... DefaultItemOpen="1">
       2: ...
       3: </List>
  4. The most interesting step. After form was provisioned into custom doclib:
  5.    1: <Module Name="SomeForm" List="115" Url="CustomForms" Path="">
       2:    <File Url="SomeForm.xsn" Type="GhostableInLibrary" />
       3: </Module>

    it was not browser-enabled despite of the fact that previous 2 steps were done. I made investigation of this problem and found that in order to make InfoPath form browser-enabled after provisioning you need to re-publish this form manually using InfoPath application into the same doclib using the same form name (same URL).

I found several ways to reach the result without manual publishing:

Both approaches were not suitable for us because one of the requirements was that forms should be provisioned into custom doclib on non-root site. So we decided to use approach with manual republishing of InfoPath form after provisioning.

Second problem was to configure anonymous access to InfoPath forms. First of all you need to make usual steps when you want to turn on anonymous access to doclib or list (e.g. http://nickgrattan.wordpress.com/2007/07/18/anonymous-access-in-sharepoint-2007/). However it is not enough to allow anonymous users to submit form to server. I tried many approaches but only one of them really worked: approach when all data connections in InfoPath form are configured via anonymous enabled web service (see http://sheetal-d.spaces.live.com/blog/cns!237C3DEA7120098B!632.entry). Author of this post says that he verified this information from SharePoint team also.