Extending Forms

Applies to: SharePoint Foundation 2010

This topic provides an overview of the ways in which the Form content type in Microsoft SharePoint Foundation can be extended.

Third-party developers can create a DLL that provides a launcher control for opening the XML files of a Form content type in an XML editor that is compatible with SharePoint Foundation. The Form content type is an extension of the Document content type and is designed for XML files.

The Form content type provides the following functionality for working with XML files:

  • Property Promotion and Demotion   Promotes data stored in the XML file as columns in the SharePoint Foundation library, and allows writing back to the document through those properties.

  • Link Management   Keeps links in the XML files associated with the template of the form.

  • Merge Forms   Sends multiple XML files to a client application to be merged.

Creating and Registering a Launcher Control

Third-party developers can create a DLL that provides the launcher control for opening XML documents in an XML editor. The control must provide the same interface for creating, editing, and merging XML files, as well as for customizing templates, as described for the OpenXMLDocuments Control control. The control must have a ProgID, such as SharePoint.OpenXMLDocuments, and be installed and registered on the client computer.

The Understanding DocIcon.xml Files file for a SharePoint Foundation deployment can be customized so that the ProgID (for example, Word.Document) and the file name extension of a specific document type map to the ProgID of the launcher control and to an icon for representing documents in the form library.

Property Promotion and Demotion

SharePoint Foundation provides both document property promotion and demotion for XML forms.

SharePoint Foundation includes a built-in XML document parser you can use to promote and demote the properties included in your XML documents. Because forms are XML documents, SharePoint Foundation automatically invokes the built-in XML parser whenever document property promotion or demotion is required.

Note

Property promotion refers to extracting values from a form, and writing those values to the appropriate columns on the library where the form is stored. Property demotion refers to taking column values from the library where a form is stored, and writing those column values into the document.

For more information, see XML Document Property Promotion and Demotion.

Link management allows you to keep the forms assigned on a given form content type synchronized with the form content type template. The mechanisms for link management include the following:

  • Automatic link management    After a form is synchronized with the template, if any site, subsite, or library is renamed, the link is kept synchronized automatically with the template URL of the form content type.

    Note

    Link management does not occur right away. A flag is set and it occurs when the file is requested for download.

  • Manual relink   If the form is initially out of synch with the template URL of the form content type, selecting Relink forms to this form content type on the Customize page allows a manual relinking. This is used for uploaded documents, or for forms copied from one server to another.

Both mechanisms require that the TemplateUrl column in the Form content type specify the location in the XML form where the form template is specified. This enables SharePoint Foundation to demote the correct template location into the XML documents assigned to this content type.

If this information is stored in a processing instruction (PI) in the XML form, use the PITarget and PIAttribute attributes in the TemplateUrl column definition to specify its location, as shown in the following example.

<FieldRef 
  ID="{4B1BF6C6-4F39-45ac-ACD5-16FE7A214E5E}" 
  Name="TemplateUrl" 
  PITarget="PI_Element" 
  PIAttribute="PI_Attribute"/> 

In addition, you can specify a primary location in a processing instruction where SharePoint Foundation should look first, before looking in the location specified by the PITarget and PIAttribute attributes. To do this, you add another pair of attributes: PrimaryPITarget and PrimaryPIAttribute. If these attributes are present, SharePoint Foundation looks for the template URL in the location they specify first. If there is a value at that location, the parser uses that value and ignores the PITarget and PIAttribute attributes, as shown in the following example.

 
<FieldRef 
  ID="{4B1BF6C6-4F39-45ac-ACD5-16FE7A214E5E}" 
  Name="TemplateUrl" 
  PrimaryPITarget="primaryPI_Element" 
  PrimaryPIAttribute="primaryPI_Attribute" 
  PITarget="PI_Element" 
  PIAttribute="PI_Attribute"/> 

If this information is stored in the XML content of the form, use the Node attribute in the TemplateUrl column definition to specify its location, as shown in the following example.

<FieldRef 
  ID="{4B1BF6C6-4F39-45ac-ACD5-16FE7A214E5E}" 
  Name="TemplateUrl" 
  Node="XPath"/> 

For more information about how SharePoint Foundation uses these attributes to promote and demote document properties such as the template URL, see Using Content Types to Specify XML Document Properties.

Merge Forms

Merge forms provides the Form content type with a mechanism for providing a combined view of forms that have the same schema.

For merging to be enabled for a content type, that content type must contain the Merge site column, with an internal name of "Combine." By default, the Form content type includes the Merge site column with the appropriate internal name. The Merge column enables users to select which forms they want to merge.

See Also

Concepts

XML Document Property Promotion and Demotion