Partilhar via


Developing and Deploying Form Templates for InfoPath Forms Services

Applies to: SharePoint Server 2010

Developing InfoPath form templates that work with InfoPath Forms Services is supported in InfoPath Designer 2010 by setting the correct compatibility settings. This can be done when first creating a form template or at any point during the development of the form template. Deploying InfoPath form templates that work with InfoPath Forms Services can be done from the InfoPath Designer 2010 user interface (UI) in the following two cases:

  1. If the form template does not contain custom business logic written in code.

  2. If the form template contains business logic written to the default subset of the members of the Microsoft.Office.InfoPath namespace that are allowed to run on SharePoint as a sandboxed solution. To do this, the user publishing the form template must be a site collection administrator of the site where the form template is published.

If the custom business logic in the form template requires full trust to run, for example if it must run code that can access the file system, a server administrator must approve and deploy the form from the SharePoint 2010 Central Administration site.

Using the Compatibility Settings

The compatibility settings of InfoPath Designer 2010 control many UI elements when you design a form template, such as which controls are available and warnings about how a specific control may behave in the browser. To create a form compatible with both InfoPath Filler and InfoPath Forms Services, select the Blank Form template (without (InfoPath Filler) following the template name) when you create a new form. To change these settings, click the Compatibility category of the Form Options dialog box, which is available by clicking the File tab, and then clicking Form Options when you design a form template. You can also display the Design Checker task pane by clicking the File tab, and then clicking Design Checker. In the Design Checker task pane, you can click the Change settings link to go directly to the Compatibility category of the Form Options dialog box.

Using the Design Checker

The Design Checker task pane displays errors and messages about items present in the form template that may cause problems when it is deployed to a server that is running InfoPath Forms Services. Use this information to determine whether your form template will function correctly in the browser or if changes have to be made before deployment. Especially if you are upgrading a form template, there may be many controls in the view that are not supported on the server. For more information about what controls are supported in browser-compatible form templates, see Creating InfoPath Form Templates That Work With InfoPath Forms Services.

For a fuller report on compatibility, check the Verify on server check box under the errors and messages list in the Design Checker task pane. InfoPath contacts a server that is running InfoPath Forms Services, specified in the Compatibility category of the Form Options dialog box, to return detailed information about the compatibility of the form template. If you do not have access to InfoPath Forms Services, addressing the errors and messages in the Design Checker task pane will enable you to create a compatible form template that can be deployed to a server that is running InfoPath Forms Services when it is made available.

Important

If you are designing a form to be used in both the InfoPath Filler and in a browser, and you must use excluded object model members of the Microsoft.Office.InfoPath namespace when the form is opened in the client, you can hide errors in the Design Checker task pane by clicking the Allow code to use features that work only when filling forms with InfoPath Filler check box on the Compatibility category in the Form Options dialog box.

Deploying Form Templates

Deploying browser-compatible form templates is performed through the Publishing Wizard in InfoPath 2010. Depending on whether the form template contains custom code will determine who can actually deploy the form template to the site and how it can be deployed.

Deploying Form Templates That Do Not Contain Code or Require Full Trust

If your form template does not contain code, or contains code that does not require Full trust (and you are a site collection administrator), it can be deployed directly to a SharePoint site from the InfoPath 2010 Designer user interface. This is the first step for turning a browser-compatible form template into a browser-enabled form template. This means that it has been converted by InfoPath Forms Services to be rendered in a browser. To do this, follow these steps:

  1. Open the Publishing Wizard by clicking the File tab, clicking Publish, and then clicking SharePoint Server.

  2. On the first screen of the Publishing Wizard, enter the URL of a SharePoint Server that you have at least Contribute rights to, which means that you can add and delete content on the site, and then click Next.

  3. On the second screen of the Publishing Wizard, keep the default settings of Enable this form to be filled out by using a browser and Form Library. Note the last option is to create a form for administrator approval, and then click Next.

    Note

    If you are publishing a form template that contains code that requires Full trust, select Administrator-approved form template (advanced), and then go to the "Deploying Form Templates That Require Administrator Approval" section of this topic.

  4. On the third screen of the Publishing Wizard, keep the default setting of Create a new form library, and then click Next.

  5. On the fourth screen of the Publishing Wizard, give the document library a name, and then click Next.

  6. On the fifth screen of the Publishing Wizard, click the Add button to select fields from the form template that will be shown as columns in SharePoint sites and in Outlook folders. You can also select fields that will be available as SharePoint Web Part connection parameters, if the form is displayed in the InfoPath Form Web Part. Both of these field selections are optional. After you are finished, click Next.

  7. On the last screen of the Publishing Wizard, click Publish. This will deploy the form template to the document library and make it available. After you do this, click the Open this form in the browser link to see the browser-enabled form.

Deploying Form Templates That Require Administrator Approval

Administrator approval is required for form templates that require Full Trust. For reasons of security and manageability, form templates with custom code that requires full trust must be uploaded and activated by someone with Administrator rights to the SharePoint 2010 Central Administration site. If you do not have these rights, you must find a person who does. If you have these rights, follow these steps to browser-enable a form template that contains custom code.

To finish publishing the form template

  1. Follow the steps in the "Deploying Form Templates That Do Not Contain Code or Require Full Trust" section earlier in this topic until you reach step three, which is through the second screen of the Publishing Wizard. Here, select Administrator-approved form template (advanced), and then click Next.

  2. On the third screen of the Publishing Wizard, type a location and file name for the form template (.xsn) file. This can be on your local hard disk, a network file share, or a Web server. Click Next.

  3. On the fourth screen of the Publishing Wizard, click the Add button to select fields from the form template that will be shown as columns in the form library and in Outlook folders. You can also select fields that will be available as SharePoint Web Part connection parameters, if the form is displayed in the InfoPath Form Web Part. Both of these field selections are optional. After you are finished, click Next.

  4. On the last screen of the Publishing Wizard, click Publish. This saves your form template (.xsn) file to the location that you specified, and it is now ready to be uploaded to the server.

To upload the form template to the server

  1. Open the SharePoint 2010 Central Administration site.

  2. Under General Application Settings, click the Manage form templates link.

  3. Click the Upload form template link near the top of the page.

  4. Click the Browse button to open a dialog box, and enter the path of the published form template.

  5. Click the Verify button to verify that the form template has no errors. This step is optional.

  6. Click the Upload button to upload the form template to the site. After uploading is finished, click the OK button.

To activate the form template to a site collection

  1. On the Manage Form Templates page, locate the form template that you uploaded.

  2. Click the drop-down, and then select Activate to a Site Collection.

  3. In the Activation Location section, click the drop-down, and then select Change Site Collection.

  4. On the Select Site Collection dialog box, click the Web Application drop-down, and then select Change Web Application.

  5. Click SharePoint - 80. This should be the name of your default SharePoint Server. If not, select your default SharePoint Server.

  6. Click the site collection name that you want to activate the form to, and then click OK.

  7. On the Activate Form Template page, click OK.

  8. Alternatively, if you are a site collection administrator, you can activate a published form template from the site collection administration page. To do that, open the top-level site collection page, click the Site Actions drop-down list, click Site Settings, and then click Site collection features under Site Collection Administration. Locate the uploaded form template, and then click the Activate button.

After a form is activated to a site collection, it is available for use and listed in the Form Templates document library.

See Also

Other Resources

Developing InfoPath Form Templates with Code

How Do I...In InfoPath Form Templates with Code

About the Security Model for Form Templates with Code

How to: Preview and Debug Form Templates that Require Full Trust

How to: Configure Security Settings for Form Templates with Code