Deploy a Fully Trusted Form to a SharePoint Form Library [InfoPath 2003 SDK Documentation]

Applies to:

Microsoft Office InfoPath 2003

Microsoft Office InfoPath 2003 Service Pack 1

One of the most useful features in Microsoft Office InfoPath 2003 is the ability to publish a form to a form library on a server that is running Microsoft Windows SharePoint Services. By default, forms published to SharePoint form libraries are restricted from accessing system resources and are not allowed to use any software components that are not marked as safe for scripting. Such forms are said to be sandboxed; when a user fills it out, the form is placed in a local cache and denied access to system resources. This type of form inherits its permissions from the domain in which it is opened. You can avoid these limitations by creating a fully trusted form.

Why Use a Fully Trusted Form?

Fully trusted forms have more permissions than sandboxed forms do. For example, they can contain code that uses external objects for accessing system resources; they can use software components or Microsoft ActiveX controls that are not marked as safe for scripting; and they can use custom business logic provided by Component Object Model (COM) components.

In addition, some members of the InfoPath object model are set to security level 3, which means that they can only be used in a fully trusted form. For example, to access the Microsoft Office CommandBars object, you use the CommandBars property of the InfoPath Window object to set a reference to it. Because this property is set to security level 3, it cannot be used in a form that is not fully trusted.

There are two ways to convert a standard form to a fully trusted form: by registering the standard form using the RegForm tool, or by digitally signing the form. For more information about using the RegForm tool to convert a form to a fully trusted form, see Understanding Fully Trusted Forms.

Deploy a Fully Trusted, Registered Form to a SharePoint Form Library

Forms that are made fully trusted through registration must be installed on the client computer. Deploying such fully trusted forms involves deploying form files in two locations:

  1. The form's XML template file is deployed to a SharePoint form library.
  2. The form is deployed to the computers of users who will be using the form.

Once the appropriate files have been deployed, clicking the XML template file in the SharePoint form library will start an instance of the form on the client computer.

Deploying a Fully Trusted, Registered Form to a Form Library

Step 1: Make a Form Fully Trusted

To use the RegForm tool to convert a form to a fully trusted form, follow these steps. (Proceed to Step 2 if you have already created a fully trusted form.)

  1. On the Windows Start menu, click Run.

  2. In the Open text box, type cmd and click OK.

  3. Navigate to the folder that contains the RegForm tool.

  4. Type the following at the command prompt:

    RegForm /U urn:MyForm:MyCompany /T Yes C:\MyForms\MyTrustedForm.xsn
    

Replace the values for the /U option and the name of the form template file with your own requirements and file location. The /U option provides the URN; the /T option indicates that the form should be marked as a fully trusted form; and the last parameter is the file and path name of the form template that is to be converted.

The tool will create a .js file and a .bak file in the same folder that contains the form template that you are converting. The .bak file is a copy of the original form template file before the changes were made to it; the .js file is a script file that can be used to install the fully trusted form.

In addition to creating a .js file for installing a fully trusted form, the RegForm tool supports creating an .msi file if you have Microsoft Visual Studio .NET installed. To create a Microsoft Installer file (.msi), use the /MSI option, as shown in the following example:

RegForm /U urn:MyForm:MyCompany /T Yes /MSI C:\MyForms\MyTrustedForm.xsn

Replace the values for the /U option and the name of the form template file with your own requirements and file location.

The tool creates an .msi file in the same folder that contains the form template that you are converting. The RegForm tool also creates a Visual Studio .NET setup project in the %temp%\RegForm directory. You can use this project to modify the installation routine to fit your requirements.

Note  If you use the /MSI option and you do not have Visual Studio .NET installed, the RegForm tool creates the default .js file for installing the fully trusted form.

Other options can be used with the RegForm tool to provide more control over the values that it uses, such as the form template name, company name, and version number. To learn how to use these and other options, use the /? switch to view the RegForm tool command-line Help, as shown here:

RegForm /?

Step 2: Install a Fully Trusted Form Template on the Client Computer

The RegForm tool creates a .js or .msi file in the same folder as the form. Run the .js or .msi file, as applicable, to register and install a fully trusted form template on the client computer. By default, the template has the same name as the form, has .xsn as its file extension, and is created in the folder C:\Program Files\InfoPath Form Templates.

Step 3: Create a SharePoint Form Library

To create a SharePoint form library, follow these steps:

Note  In order to create form libraries, you must have permission to modify the site where the form library will be stored.

  1. Open your SharePoint site's home page.
  2. On the menu bar at the top of the page, click Create.
  3. On the Create Page page, under Document Libraries, click Form Library.
  4. In the Name box, type a name for the library. The form library name is required.
  5. In the Description box, type text that describes the purpose of the library. The description is optional.
  6. To add a link to this library on the Quick Launch bar, in the Navigation section, click Yes.
  7. To create a backup copy of a file each time it is checked into the library, in the Document Versions section, click Yes.
  8. At the bottom of the page, click Create.

Step 4: Set the Form's XML Template as the Default Form Template for the SharePoint Form Library

Follow these steps to set the XML template file as the SharePoint form library's default form.

  1. Start InfoPath. In the Fill Out a Form dialog box, click Open and select the fully trusted registered form template that was created at the end of step 2.
  2. Click File and Save As. Specify the name template.xml and save a copy of the form template on the local computer.
  3. Open the form library's main page.
  4. Click Explorer View.
  5. Open the Forms folder.
  6. Copy and paste template.xml from the local computer to the form library.

Note  If you do not want your form's XML template to be named as template.xml, then follow these additional steps in order to set the template as the form library's default form.

  1. Open the form library's main page.
  2. Under Actions, click Modify settings and columns.
  3. On the Customize <Form Library Name> page, under General Settings, click Change general settings.
  4. Under Form Template, in the Template URL box, type the path and filename of the form that you uploaded to the form library in the previous steps.

Step 5: Deploy the Form to Client Computers

At this point, your form's XML template file has been copied to a new SharePoint form library and it has been set as the SharePoint form library's default template. The form will not work, however, unless it has been installed on the computer of each user. There are several approaches that you should take in order to accomplish this task:

  • Place a link to the form's installation package (.msi) in the form library's Description field. Follow these steps to modify the form library's Description field:

    1. Open the form library's main page.
    2. Under Actions, click Modify settings and columns.
    3. Under General Settings, click Change general settings.
    4. Under Name and Description, type link to your form's .msi file along with the appropriate instructions to the user in the Description box. Click OK to accept the change.
  • You can use an HTML editor, such as Microsoft FrontPage, to add instructions on how to install the form to the form library's main page.

    Caution  If you do this, you should make a a backup copy of the page.

Deploying a Fully Trusted, Digitally Signed Form to a SharePoint Form Library

Step 1: Make a Form Fully Trusted

You can make a form fully trusted by specifying full trust for the form and signing it digitally. For more information on digital signature and signed form templates, see "About digital signatures" in the InfoPath 2003 Help and Deploying Signed Form Templates.

  1. In design mode, on the Tools menu, click Form Options.
  2. In the Form Options dialog box, click the Security tab.
  3. Clear the selection for Automatically determine security level based on form's design (recommended), if it is selected.
  4. Select Full Trust (the form has access to files and settings on the user's computer).
  5. Under Form Signing, select Sign this form.
  6. Click Create Certificate to create a new digital certificate.
  7. Alternatively, click Select Certificate to select an existing certificate. In the Select Certificate dialog box, click the certificate that you want to digitally sign the form with.
  8. Click OK.

Step 2: Publish the Form Template to a SharePoint Form Library and Set it as the Default Form

Follow these steps to publish the form template to the SharePoint form library and to set its XML template file as the SharePoint form library's default form.

  1. On the File menu, click Publish.
  2. Follow the instructions in the Publishing Wizard to publish the form template to the SharePoint form library. For more information, see "Publish a form template" in the InfoPath 2003 Help.

Create a Form Based on a Fully Trusted, Digitally Signed Form Template

  1. In the SharePoint form library, click Fill Out the Form.

    Note  After publishing the form template to a SharePoint form library using the Publishing Wizard, the template is not displayed as an item in the form library. When you create a form in that form library, the template will be used by default as the template for the new form.

  2. If the default form template has been digitally signed, InfoPath displays a security warning about the digitally signed form template. Select Always trust files from this publisher and open them automatically. Then click Open.

See Also | Deploying Signed Form Templates | Understanding Fully Trusted Forms