There is a lot of information on the web regarding how to publish InfoPath forms as full trust admin approved forms. This is just yet another step by step guide. So let’s get started:
The first step (and I am going to assume that you have already done that) is to create your InfoPath form as you would. Create local data connections, fields, views and layouts. I have always felt that doing everything up front (like making the template as admin-approved) before the development is complete is going to lead to a lot of head-aches and clicking that can be easily avoided.
The steps below will help you convert your local form to admin-approved.
Create a development certificate for your form template
For a form to run with full trust, it must be installed or digitally signed with a certificate. Web browser forms require full trust if they contain code, and must be deployed by a server administrator. As the forms I was deploying had custom code and was published on the SharePoint server, we were required to sign the form templates with security certificate.
For development, you can create a self-signed digital certificate using “Digital Certificate for VBA projects” application. This tool is installed with Microsoft Office and should be available on your development machine. Otherwise you can create a development certificate that is valid for 1 month from InfoPath designer.
Clicking OK on this dialog will create and install the certificate on your machine. When you are ready with your form to deploy to production, you will need to buy a “Code Signing” certificate from a certificate authority. I will have a follow up blog post about it soon.
Update InfoPath Form properties
Now that we have a development certificate, it is time to update our InfoPath form. You have a working form don’t you?
- Open your InfoPath form in design mode.
- Navigate to File ribbon tab and select Advanced form options.
- Set the security level of the form to Full Trust.
- Select “Sign this form template” checkbox and select the certificate we created in the section above.
We could have created a development certificate from this dialog as well, but the certificates generated here are valid for 1 month only. This might be limiting on the long running projects where you are following the full software development lifecycle (SDLC).
- Next step will be to ensure that the compatibility is set to “Web Browser Form”. This is essential if you would like to store the data connections on the SharePoint server. If this option is not configured properly, you will not be able to publish the data connections to the SharePoint server.
Click OK to save the changes you have made.
Convert InfoPath data connections
This is an optional step. I am guessing that if we are publishing the form template on SharePoint server and have multiple SharePoint environments (read DEV, TEST, UAT, PROD, DR) then it is a good practice to store the data connections at a central location. This will solve the issues with updating your forms once they have been tested. Publishing data connections to the Central Administration application will allow you to update the environment details without modifying your form.
- We will create a new Data Connections Library on the SharePoint site. This is a temporary library where InfoPath will publish the data connections.
- Navigate to “View All Site Content” page via the “Site Actions” menu.
- Click the “Create” link to create a new library.
- Under Libraries column select “Data Connection Library”.
- Give the name “DataConnections” to the library and click the “Create” button.
- Make a note of the URL. In my example here we have “http://sp2010/DataConnections/”.
- Next, we will publish the local InfoPath data connections to SharePoint site. This is an interim step before we can publish these files to Central Administration.
- Open your InfoPath form in Design mode.
- Navigate to Data ribbon tab and open “Data Connections”.
- Click “Convert to Connection File…” button.
- Enter the full URL for the connection we are trying to convert. This includes the URL of the “DataConnections” library we created in the step above, and the name of the data connection.
- Leave the connection link type to default of “Relative to site collection”.
- Click OK to publish the file to the SharePoint library. Verify a connection file was created in the SharePoint library.
- Publish all the data connections in the form using the steps above. Once all the connections are published, navigate to Data Connections library and download all the files to your local drive. To download, click on the name link and you will be prompted to save the file.
- After you have downloaded all the connection files, Navigate back to the Data Connections dialog in the InfoPath form.
- Select a data connection and click “Modify…” button. The data Connection Wizard will appear.
- Click “Connection Options…” button and modify the option to “Centrally managed connection library”.
- Click OK to change the connection link type. On Data Connection Wizard dialog, click next a few times to finish the wizard and save the connection.
- Perform the actions again for all remaining data connections.
- Let’s upload our data connection files to Central Administration.
- Open Central Administration and navigate to “General Application Settings” –> “InfoPath Forms Services” –> “Manage data connection files”.
- Click the “Upload” link to upload a new data connection file.
- Upload the data connection file that was downloaded from the DataConnection library of the site.
- Enter the category name (optional) and select “Allow HTTP access to this file” checkbox.
- Click the “Upload” button to save the file.
- Follow the steps again for all the remaining data connection files you have.
- After uploading all the data connection files, navigate to the Data Connections library in your SharePoint site (used here: http://sp2010/DataConnections/) and delete all data connections from this library. This is not required as we have updated our form to look for data connections in Central Administration.
Publish InfoPath Form to Central Administration
The last step for this guide is to publish the InfoPath Form template to Central Administration. Doing so will make this template available as a “Content Type” in your SharePoint environment. If you don’t want to access these forms via SharePoint library, you can either publish this form template to Network folder or install it on user machines using traditional installers. In our exercise, we will be publishing this form to a Site Collection.
- Open Central Administration and Navigate to “General Application Settings” –> “InfoPath Form Services” –> “Manage form templates”.
- Click “Upload form template” link to upload the form.
- Select the Form template from the published location and upload the form.
- After uploading the form, wait till the form template status changes to “Ready”.
- Using the form context menu (read ECB) select, “Activate to Site Collection” option and select the site collection where you would like this template to be available.
- Click OK to activate the Form Template.
That’s it folks. You can now add this Form Template as content type to your SharePoint Libraries.