Export (0) Print
Expand All
Add a Recycle Bin to Windows SharePoint Services for Easy Document Recovery
Use Windows SharePoint Services as a Platform for Building Collaborative Applications
Use Windows SharePoint Services as a Platform for Building Collaborative Apps, Part 2
Expand Minimize

Integrating Microsoft SharePoint Products and Technologies and Microsoft Office InfoPath 2003

SharePoint 2003
 

Ronald Tielke
Microsoft Corporation

November 2003

Applies to:
    Microsoft® Office SharePoint™ Portal Server 2003
    Microsoft Office InfoPath® 2003
    Microsoft Windows® SharePoint Services 2003

Summary:   Use the Microsoft Office System, including Microsoft Office InfoPath 2003, Microsoft Office SharePoint Portal Server 2003, and Microsoft Windows SharePoint Services 2003 to develop integrated, form-based solutions that streamline existing information-gathering processes. (19 printed pages)

Download SharePoint_Integrating_InfoPathSample.exe.


Contents

Introduction
Scenario
Solution
Resources
Conclusion

Introduction

Microsoft® Office InfoPath™ 2003 is a new application that streamlines the process of gathering information by enabling teams and organizations to create and work with rich, dynamic forms. You can easily configure an InfoPath form-based solution to integrate with the capabilities and features of Microsoft Office SharePoint™ Portal Server and Microsoft Windows® SharePoint Services to improve the information gathering process.

This article describes the integration of SharePoint Portal Server, Windows SharePoint Services, and InfoPath. It presents a typical workgroup collaboration scenario—team status reporting—and shows how these products and technologies can work together to improve a status-reporting process. The article also walks through an accompanying solution that implements this scenario. The solution is a working example that demonstrates the possibilities of integrating these products and technologies.

Prerequisites

It is recommended that you are familiar with the following:

  • Microsoft Windows SharePoint Services
  • Microsoft Office SharePoint Portal Server 2003 and object model
  • Microsoft Office InfoPath 2003 and object model
  • Microsoft XML Parser (MSXML) 5.0 object model
  • Extensible Markup Language (XML), XSL Transformations (XSLT), and XML Schema Definition (XSD)
  • ASP.NET Web Services
  • Microsoft® Jscript® or Microsoft Visual C® development tool

System Requirements

The solution discussed in this article requires the following technologies:

  • Microsoft Windows SharePoint Services
  • Microsoft Office SharePoint Portal Server 2003
  • Microsoft Office InfoPath 2003
  • Microsoft Visual Studio® .NET 2003
  • Microsoft Internet Explorer 6.0 (latest service pack recommended, but not required)

Scenario

You can use SharePoint Products and Technologies in combination with InfoPath to improve status reporting with a project team.

Members of a project team compose and submit project status reports on a weekly basis. The status report covers topics such as tasks, progress, issues, hours logged, and budget expended. The project manager reviews the status report submission for each team member and consolidates relevant information from all team members into a single report, which is then specified to the project sponsor.

Existing Ad-Hoc Process

Project teams use a generic status report document and store all status reports on a file share. The status report process typically operates as follows:

  • Team Member Creates a Status Report   The team member opens a local, possibly outdated, copy of the generic status report document. The team member types new information for the current reporting period. The team member must also re-type all static information, as well as any information the team wants to carry forward from a previous status report.
  • Team Member Submits a Status Report   The team member posts the completed status report to a file share and sends an e-mail message to the project manager; alternately, the team member mails the status report to the project manager.
  • Project Manager Collects Individual Status Reports   The project manager checks both the file share and e-mail periodically, looking for new status reports.
  • Project Manager Browses Status Reports   The project manager must open a specific report to examine its contents, even if the project manager wants only a quick summary of the status report.
  • Project Manager Searches Status Reports   The file share is not included in an index by a search engine, so searches against the contents of the status reports are not possible.
  • Project Manager Creates the Consolidated Status Report   Once all reports are submitted, the project manager goes through a time-consuming, manual process to generate the consolidated status report for the project sponsor.
  • Project Manager Submits the Consolidated Status Report   The project manager posts the completed status report to a file share and sends an e-mail message to the project sponsor; alternately, the project manager mails the status report to the project sponsor.

Improved Process

Project teams use a status report form, which is implemented using InfoPath. The form uses custom Web services to obtain information about the user and pre-populates the form. A form library on a SharePoint site hosts the form and stores all subsequent status reports. The form promotes its fields as columns to the form library, thus allowing the associated content to be summarized and searched. The improved status report process operates as follows.

Team Member Creates a Status Report   The team member visits the form library and clicks Fill Out This Form, which launches the most current release of the status report form. As the form loads, it calls Web services to obtain information (for example, user profile, current projects) related to the team member. It uses this information to pre-populate various form fields, thus allowing the team member to focus on adding new information for the current reporting period. In addition, it could be used to display only those fields that are relevant to the user. For example, when the form is loaded and displayed, the manager is presented with an aggregate summary.

If it is necessary to carry forward information from a previous status report, the team member can use InfoPath to import the contents of that status report. To do so, users click Merge on the File menu and then navigate to the form library where they can select other reports to merge into the current report.

Team Member Submits a Status Report   The team member clicks Submit on the status report form to post the completed status report to the form library. The code behind the action ensures that the status report is posted to the correct location.

Project Manager Collects Status Reports   The project manager views the form library and clicks Alert Me to configure an alert that generates an e-mail whenever team members submit a status report to the form library.

Project Manager Browses Status Reports   The project manager views the form library and clicks Select a View to choose among a number of custom views designed to present specified fields of the status report forms in custom formats. Custom views reduce the need to open a specific report to examine its contents.

Project Manager Searches Status Reports   The project manager visits the form library and searches against the specified fields of the status report forms.

Project Manager Creates a Consolidated Status Report   After all reports are submitted, the project manager visits the form library and clicks Merge View to generate the consolidated status report for the project sponsor.

Project Manager Submits the Consolidated Status Report   The project manager clicks Submit on the status report form to post the completed status report to the form library.

Project Sponsor Collects Status Report   The project sponsor views the form library and clicks Alert Me to configure an alert which generates an e-mail whenever the project manager submits a status report for the project to the form library.

Solution

The following sections review the components of the working solution that accompanies this article, called IntegratingInfoPathandSharePoint.EXE. This solution implements the status reporting scenario described previously. Figure 1 shows a diagram outlining the process.

Click here to see larger image

Figure 1. Overview of the solution (click picture to see larger image)

Web Services

SharePoint Portal Server provides a suite of Web services that allow client computers to interact with the back-end database component. In addition, the Web server capabilities of SharePoint Portal Server allow the server to host custom Web services and applications that interact with the back-end database to provide targeted functionality to client applications. InfoPath capitalizes on these applications and Web services to provide an integrated experience for the user.

The status report form contained in the solution that accompanies this article takes advantage of two custom Web services, described below, to obtain information related to the person who is filling out the form. InfoPath uses this information to pre-populate the fields of the form.

Profile Web service

The Profile Web service provides user profile information to the caller. The user profile information is generally public, directory-class information that is related to a specific person. The Web service also detects the identity of the caller and can return the corresponding user profile information. The Web service obtains user profile information by using the portal object model to query the profile database.

The Profile Web service provides the following methods:

// Detects the identity (i.e., user name) of the caller and returns the 
// user profile associated with that identity.
[WebMethod]
public Profile GetMyProfile()

// Returns the user profile associated with the specified account.
[WebMethod]
public Profile GetUserProfile(string accountName)

Note   SharePoint Portal Server provides a User Profile Web service, but that service does not detect the identity of the caller; the caller must pass the account name to the service to obtain user profile information.

Project Web service

The purpose of the Project Web service is to provide project information to the caller. The project information is generally public information that is related to a specific person. In a real-world implementation, this Web service interacts with a back-end enterprise resource planning (ERP) database. For the purposes of this solution, the Web service returns fictitious data.

The Project Web service provides the following method:

// Returns an array of projects associated with the specified employeeId.
[WebMethod]
public Project [] GetProjectsByConsultant(int employeeId)

Implementation notes

When you install the solution that accompanies this article, notice that the Profile and Project Web service projects do not reside in the same virtual directory on the server as the default Web services for SharePoint Portal Server. Instead, the services reside in a separate virtual directory that is excluded from processing by SharePoint Portal Server.

Using an excluded virtual directory simplifies the development, deployment, and management models for the Web services. You control the location of the projects on the file system; as a result, they are easier to locate and easier to open in Visual Studio.Net. You do not have to customize support for WSDL and DISCO when you deploy the services. You assume full control over the associated configuration files, the resulting execution environment, and the security model of the virtual directory. You eliminate the risk of affecting the SharePoint Portal Server deployment and the contents of its installation directories. You eliminate the risk of having your files overwritten by upgrades and service pack installations. Code that executes in the excluded virtual directory can still interact with the local instance of SharePoint Portal Server.

Status Report Form

An InfoPath form collects information from a user in a structured manner and submits the resulting form to a fixed storage location. You can easily extend and configure an InfoPath form to integrate with SharePoint Portal Server and Windows SharePoint Services.

The IntegratingInfoPathandSharePoint.EXE sample is an enhanced version of the sample form included with InfoPath. The following sections discuss these enhancements.

Schema Extensions

The form requires an extended XML schema in order to deliver enhanced functionality. The schema contains the following new fields:

<my:periodEnding>   A date field that represents the last date of the reporting period.

<my:client>   A string field that represents the company name of the customer.

<my:Title>   A string field that represents the title of the status report. This required field establishes the name for the status report file when it is posted to the form library.

<sr:employee><my:accountName>   A string field that represents the fully-qualified account name (for example, domain\user_name) of the employee who is associated with the status report.

<sr:employee><my:alias>   A string field that represents the user name of the employee who is associated with the status report.

<sr:employee><my:emailLink>   An XHTML field that represents the e-mail hyperlink of the employee who is associated with the status report.

<sr:employee><my:profileUrl>   A string field that represents the home page URL of the employee who is associated with the status report.

<sr:employee><my:profileLink>   An XHTML field that represents the home page hyperlink of the employee who is associated with the status report.

<sr:manager><my:accountName>   A string field that represents the user name (for example, domain\_user_name) of the manager of the employee who is associated with the status report.

<sr:manager><my:alias>   A string field that represents the e-mail alias of the manager of the employee who is associated with the status report.

<sr:manager><my:emailLink>   An XHTML field that represents the e-mail hyperlink of the manager of the employee who is associated with the status report.

<sr: manager><my:profileUrl>   A string field that represents the home page URL of the manager of the employee who is associated with the status report.

<sr: manager><my:profileLink>   An XHTML field that represents the home page hyperlink of the manager of the employee who is associated with the status report.

<my:projectManager>   A group that represents the project manager of the project that is associated with the status report.

<my:projectManager><my:accountName>   A string field that represents the fully-qualified account name of the project manager of the project that is associated with the status report.

<my:projectManager><my:alias>   A string field that represents the user name of the project manager of the project that is associated with the status report.

<my:projectManager><my:emailLink>   An XHTML field that represents the e-mail hyperlink of the project manager of the project that is associated with the status report.

<my:projectManager><my:profileUrl>   A string field that represents the home page URL of the project manager of the project that is associated with the status report.

<my:projectManager><my:profileLink>   An XHTML field that represents the home page hyperlink of the project manager of the project that is associated with the status report.

<my:reportType>   A string field that identifies the type of the report: individual or summary.

<my:lastModifiedOn>   A date field that identifies the date on which the status report was last modified.

Note   The emailLink and profileLink fields support the display of an e-mail hyperlink and a home page hyperlink, respectively. The data that populates each node is stored in corresponding standard, non-XHTML nodes. The form loads the XHTML child nodes of the emailLink and profileLink nodes for representation as a clickable hyperlink.

Secondary Data Sources

The form can place calls to custom Web services. The form uses the following secondary data sources to communicate with the Web services:

GetMyProfile   This secondary data source binds to the GetMyProfile() method of the Profile Web service. The method takes no input arguments and returns a Profile object.

GetProjectsByConsultant   This secondary data source binds to the GetProjectsByConsultant() method of the Project Web service. The method takes an employeeId as an input argument and returns an array of Project objects associated with the specified employeeId.

The algorithm for using a secondary data source to call a Web service is as follows:

// Create an instance of the secondary data source bound to the desired Web service.
var oWebService = XDocument.DataObjects.Item("GetProjectsByConsultant");  

// Add any namespaces that are needed for subsequent DOM node selections
oWebService.DOM.setProperty("SelectionNamespaces", ". . .[add namespaces here]. . .");

// Get the input argument node
var oInput = oWebService.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/" +
  "s0:GetProjectsByConsultant/s0:employeeId"); 

// Set the input argument
oInput.text = getNodeValue("//sr:statusReport/sr:employee/sr:identificationNumber", "");

// Execute the Web service call
oWebService.Query();

// Get the response node
var oResponse = oWebService.DOM.selectSingleNode(
  "/dfs:myFields/dfs:dataFields/s0:GetProjectsByConsultantResponse");

Note   To extract the form template files from InfoPath to a temporary folder, on the File menu click Extract Form Files on the File menu. You can examine the exact format of a Document Object Model (DOM) by opening the XML file of the corresponding secondary data source (for example, GetProjectsByConsultant.xml).
By using a secondary data source to call the Web service, you eliminate the Microsoft ActiveX® warnings that appear if you use SOAP objects to call the Web service.

User Interface Changes

The form requires an extended user interface to deliver its enhanced functionality. The user interface contains the following new server controls:

Period Ending Date Picker   This server control is bound to the my:endPeriod data source element.

Home Page Rich Text Box   This control is programmatically populated with a hyperlink, based on information obtained from the Profile Web service. Note that this control must be a Rich Text Box control to support programmatic hyperlink insertion.

Client Text Box   This server control is programmatically populated according to the selection present in the Project drop-down list.

Project Manager Text Box   This server control is programmatically populated according to the selection present in the Project drop-down list.

Report Type Drop-Down List   This server control is bound to the my:reportType data source element.

Submit Button   This server control submits the form to the form library.

The user interface contains the following modified controls:

Project Drop-Down List   This control (formerly a text box) is bound to the GetProjectsByConsultant secondary data source. The Client, Billing Code, and Project Manager Text Box server controls all vary according to the current selection of this server control. This ensures that the user provides valid project information when completing the form.

E-mail Address Rich Text Box   This control (formerly a text box) is programmatically populated with a hyperlink, based on information obtained from the Profile Web service. Note that this control must be a Rich Text Box control to support programmatic hyperlink insertion.

Online Detection

The form can determine if the user is connected to the network. The OnLoad() event handler attempts to use the GetMyProfile secondary data source to call the Profile service to obtain directory-class information from the user profile database about the person who is completing the form. The result of that operation determines if the user is online (that is, connected to the network).

The following code example shows how online presence is determined:

SetOnline(false);
try
{
  var oWebService = XDocument.DataObjects.Item("GetMyProfile");
  oWebService.DOM.setProperty("SelectionNamespaces", ". . .[code omitted for brevity]. . .");
  oWebService.Query();   
  var oResponse = 
    oWebService.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/s0:GetMyProfileResponse");
  SetUserInfo(oResponse); 
  SetOnline(true);
}
catch (e) 
{
  XDocument.UI.Alert("You must use the form in offline mode. . .")
}

Pre-Populating User Information

The form can pre-populate a number of fields with information obtained from custom Web services. If the OnLoad() event handler detects that the user is online, it calls the SetUserInfo() method to programmatically pre-populate all directory-class information related to the user such as user name, e-mail, department, manager, employee ID, and so on. The OnLoad() event handler loads the employeeId into the GetProjectsByConsultant secondary data source and calls the Project service to obtain project information that is related to the person who is completing the form. The Project drop-down list is already bound to the GetProjectsByConsultant secondary data source, so the list automatically populates with the results of the Web service call. Text boxes that depend on the current selection of the Project list are not populated until the user selects an entry from the list.

The following code example shows how the form pre-populates fields:

if (GetOnline())
{
  try
  {
    var oWebService = XDocument.DataObjects.Item("GetProjectsByConsultant");  
    oWebService.DOM.setProperty("SelectionNamespaces", ". . .[code omitted for brevity]. . .");

    var oInput = oWebService.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/" +
      "s0:GetProjectsByConsultant/s0:employeeId"); 
    oInput.text = getNodeValue("//sr:statusReport/sr:employee/sr:identificationNumber", "");
    oWebService.Query();   
    g_xmlProjects = oWebService.DOM;
   }
   catch (e) 
   {
     XDocument.UI.Alert("Problem with Project Web service: " + e.message);   
   }
}

Dependant Text Boxes

The form changes which server controls appear based on a selection within a drop-down list. The form includes text box server controls that represent other project-related fields; these text box server controls appear based on the current selection of the Project drop-down list. The dependent controls are programmatically populated in the OnAfterChange() event handler of the Project list.

The following code example shows how to create dependent text boxes:

var sProject = getNodeValue("//sr:statusReport/sr:project", "");
if (g_xmlProjects)
{
   // Sync the company name displayed on the form.
   var oProject = 
     g_xmlProjects.selectSingleNode("//s0:Project[s0:ProjectName = \"" + sProject + "\"]");
   if (oProject)
   {
      var oCode = oProject.selectSingleNode("s0:BillingCode");
      if (oCode) setNodeValue("//sr:statusReport/my:billingCode", oCode.text);
      var oCompany = oProject.selectSingleNode("s0:CompanyName");
      if (oCompany) setNodeValue("//sr:statusReport/my:client", oCompany.text);
      var oManager = oProject.selectSingleNode("s0:ProjectManager");
      if (oManager) {
        setNodeValue("//sr:statusReport/my:projectManager/my:accountName", oManager.text);
        setNodeValue("//sr:statusReport/my:projectManager/my:alias", GetAlias(oManager.text));
      }
   }
}

Programmatic Hyperlinks

The form programmatically generates and displays e-mail hyperlinks and home page hyperlinks. These links allow readers to send e-mail to the person associated with the hyperlink and to view the home page of the status report author. The SetUserInfo() method shows how to programmatically insert rich text, specifically a hyperlink, into a rich text box. The key to this operation is to append the XHTML nodes to the my:emailLink and my:profileLink nodes, which are bound to rich text box controls.

The following code example shows how to generate and display e-mail hyperlinks:

var oNode = getNode("//sr:statusReport/sr:employee/my:emailLink");
RemoveChildren(oNode);
if (oNode && sMail != "")
{
  var oLink = g_xmlDOM.createNode(1, "A", "http://www.w3.org/1999/xhtml"); 
  oLink.text = sMail;
  var oAttr = g_xmlDOM.createNode(2, "href", ""); 
  oAttr.text = "mailto:" + sMail; 
  oLink.attributes.setNamedItem(oAttr); 
  oAttr = g_xmlDOM.createNode(2, "title", ""); 
  oAttr.text = "Send e-mail to this person"; 
  oLink.attributes.setNamedItem(oAttr); 
  oNode.appendChild(oLink); 
}

The following code example shows how to generate and display home page hyperlinks:

var oNode = getNode("//sr:statusReport/sr:employee/my:profileLink");
RemoveChildren(oNode);
if (oNode && sName != "" && sUrl != "")
{
  var oLink = g_xmlDOM.createNode(1, "A", "http://www.w3.org/1999/xhtml"); 
  oLink.text = "home";
  var oAttr = g_xmlDOM.createNode(2, "href", ""); 
  oAttr.text = sUrl; 
  oLink.attributes.setNamedItem(oAttr); 
  oAttr = g_xmlDOM.createNode(2, "title", ""); 
  oAttr.text = "Visit the home page of this person"; 
  oLink.attributes.setNamedItem(oAttr); 
  oNode.appendChild(oLink); 
}

Submit Button

The form contains a Submit button that makes it easier for users to post the completed form. The OnSubmitRequest() event handler ensures that the new form is posted to the host form library.

The following code example shows the operation when a user clicks Submit:

var sSubmitUrl = sLibraryUrl + encodeURI(sTitle) + ".xml";
var oRequest = new ActiveXObject("MSXML2.XMLHTTP.5.0");
var bFileExists = true;
try
{
  oRequest.open("HEAD", sSubmitUrl, false); 
  oRequest.send(); 
  // A 404 status code indicates that the file does not exist.
  if (oRequest.status == 404) bFileExists = false;
}
catch (ex)
{
  bFileExists = false;
}
if (bFileExists) 
{
  var sPrompt = "A file with the name \"" + sTitle + ".xml\" already exists.\n\n";
  sPrompt += "Press OK to overwrite the file.\n";
  sPrompt += "Press CANCEL to abort the submit operation.\n";
  var bOverwrite = XDocument.View.Window.TaskPanes.Item(0).HTMLDocument.parentWindow.confirm(sPrompt);
  if (!bOverwrite) 
  { 
    eventObj.ReturnStatus = true;
    return;
  } 
}

Confirmation Dialog

The form generates confirmation boxes to solicit decisions from the user. The form accomplishes this in one of two ways, depending on its deployment and security model.

A fully-trusted (URN-based) form template can include a custom resource file (for example, confirm.htm) and use it in conjunction with the ShowModalDialog() method of the InfoPath Object Model. A partially-trusted (URL-based) form template does not have access to the ShowModalDialog() method; instead, it must enable a custom task pane and use the confirm() method of the browser instance that executes within the custom task pane.

The OnSubmitRequest() event handler implements the logic to prompt the user for confirmation to overwrite the file if it already exists in the form library.

The following code example shows how to implement the confirmation dialog for the form, which is a Partially-Trusted solution:

var sSubmitUrl = sLibraryUrl + encodeURI(sTitle) + ".xml";
var oRequest = new ActiveXObject("MSXML2.XMLHTTP.5.0");
var bFileExists = true;
try
{
  oRequest.open("HEAD", sSubmitUrl, false); 
  oRequest.send(); 
  // A 404 status code indicates that the file does not exist.
  if (oRequest.status == 404) bFileExists = false;
}
catch (ex)
{
  bFileExists = false;
}
if (bFileExists) 
{
  var sPrompt = "A file with the name \"" + sTitle + ".xml\" already exists.\n\n";
  sPrompt += "Press OK to overwrite the file.\n";
  sPrompt += "Press CANCEL to abort the submit operation.\n";
  var bOverwrite = XDocument.View.Window.TaskPanes.Item(0).HTMLDocument.parentWindow.confirm(sPrompt);
  if (!bOverwrite) 
  { 
    eventObj.ReturnStatus = true;
    return;
  } 
}

The following code example shows the code changes necessary to implement the confirmation dialog for a fully-trusted form template. Replace the bold lines of code in the Partially-Trusted example above with the following lines of code:

  var oParams = new Object();
  oParams.Arg1 = sPrompt;
  var bOverwrite = XDocument.UI.ShowModalDialog("Confirm.htm", oParams, 10, 10);

Form Library

The InfoPath form library is the primary integration point between Windows SharePoint Services and InfoPath. An InfoPath form library is a special type of document library that can contain and promote any information from any XML file. All documents stored within it are based on a specified InfoPath form template.

The form library is the main distribution point for a specified InfoPath form template; it allows the form to be maintained, deployed, and shared for use by the members of an organization. The form library can display columns of information extracted from the forms. With these columns, the user can create custom views to organize the forms and their content, called property promotion. The form library also makes the extracted information available for searching as part of the SharePoint site.

A form designer can use InfoPath to publish a form template directly to the form library and to define custom views for the forms.

Note   The form designer can also save the entire form library (including the form template and all views) as a list template. As a list template, the designer can then create multiple instances of the form library on the current SharePoint site or another site based on a variety of site templates such as a team-based site or portal site.

A user can visit the form library to complete new forms based on the form template. When the user completes the form, InfoPath automatically saves the resulting form directly to the form library. The user can later revisit the form library to locate and edit existing forms.

The sample uses a form library to host the status report form for the team members and project managers. The following set of procedures describes how to use forms and form libraries and how to import and export forms as templates for use on other SharePoint sites.

To publish a form template to a new form library

  1. Open the form template in InfoPath Design Mode.
  2. On the File menu, point to Publish and then click To a SharePoint form library.
  3. Click Create new form library and then specify the URL of the SharePoint site where you want to create the form library.
  4. Type the name and description of the form library.
  5. Follow the prompts to approve the promoted column names.

To publish a form template to an existing form library

  1. Open the form template in InfoPath Design Mode.
  2. On the File menu, point to Publish and then click To a SharePoint form library.
  3. Click Modify existing form library and then specify the URL of the SharePoint site.
  4. Choose the form library whose form you want to modify and then click Overwrite the existing form template.
    Note   This option is safe for user interface (UI) changes and additive schema changes.
  5. Follow the prompts to approve the promoted column names.

To create or modify a form library view

  1. Go to the form library and click Modify settings and columns.
  2. In the View section, click on the specific view to modify or click Create a new view.
  3. Configure the various settings for the view such as number and type of columns, sort options, filter and group options, and so on of the view.
  4. Click OK to save all changes.

To save a form library as a list template for the current site

  1. Go to the form library and click Modify settings and columns.
  2. In the General Settings section, click Save form library as template.
  3. Specify the name, title, and description. Click OK to save all changes.

To export a form library list template for use by other SharePoint sites and portal sites

  1. Go to the Top-level Site Administration page for the SharePoint site.
  2. In the Site Collection Galleries section, click Manage list template gallery.
  3. Right-click the list template you want to save and then, click Save Target As.
  4. Specify a location to which to save the template (STP) file and click OK.

To import a form library list template to a SharePoint site

  1. Go to the Top-Level Site Administration page for the SharePoint site for which you want to import a form library.
  2. In the Site Collection Galleries section, click Manage list template gallery.
  3. Click Upload Template.
  4. Locate and select the desired template (STP) file and then click Save and Close to add the list template.

To create a form library from a form library list template

  1. Go to the Documents and Lists page for the SharePoint site.
  2. Click Create.
  3. In the Document Libraries section, click Form Library.
  4. On the New Form Library page, type a name and description and select the desired template from the list.
  5. Click Create to save changes.

To fill out a new form

  1. Go to the form library and click Fill Out This Form.
  2. When InfoPath launches, complete the form.

To edit an existing form

  1. Go to the form library and select the desired form.
  2. When InfoPath launches, edit the form.

To save a form to the form library

From the File menu, click Save or Save As and specify the URL of the form library.

Field Promotion

The XML capabilities of the form library integrate with the underlying XML representation of an InfoPath form to provide users with a seamless experience when searching against, and viewing, the contents of forms from within the context of a form library.

XML field promotion allows users to do the following:

View form content   A designer can create a view that contains one or more fields promoted from the schema of the form. Views allow a team member or manager to view the contents of a form as columns within a view, without opening a specific form.

Search form content   A team member or project manager can search the contents of the promoted field(s).

Important   You must promote a form field as a column in order to make the field and contents available for searching. You cannot change a custom column into an InfoPath field.

Field promotions are identified in the properties.xfp file and applied to the form library during the publication process. The form library promotes form data whenever a user submits the form to the server.

To promote fields of a form to a list view of the form library

  1. Open the form template in InfoPath Design Mode.
  2. On the Tools menu, click Form Options.
  3. Click the Form Library Columns tab. On the Form Library Columns page, select the form fields to promote to the list view.
    Note   If you select a repeating field, you can specify how to treat the repeating entries when promoting to a list view. For example, you could choose plain text, merge, sum, average, and so on.
  4. Specify a column name to associate with the form field when it is displayed in the list view of the form library.

The sample promotes a number of fields to make them available for searching. The form promotes other fields to take advantage of the ability to show summary information in views of the form library.

Custom Form Library Views

Custom views allow a form library designer to create custom presentations of forms and their related content. With the aid of standard document properties and promoted fields, these views allow designers to provide focused views based on audience or work flow.

The sample takes advantage of several custom views based on work flow. The following views are designed to allow people to locate and view selected status reports quickly:

All Forms View   This view targets the general audience member who wishes to see all status reports that are submitted to the form library. The following setting provides added benefit:

  • The Group By setting displays status reports organized by groups according to ending period and then by project name.

Merge View   This view targets the project manager who needs to generate project-level summaries from the status reports submitted by the team members for a specified reporting period. The following setting provides added benefit:

  • The Filter setting shows only individual status reports.

My Forms View   This view targets the status report author who wants to see all status reports that they have submitted to the form library. The following settings provide added benefit:

  • The Filter setting shows only status reports that the current user created.
  • The Group By setting organizes status reports by group according to ending period.

Project Manager View   This view targets the project manager who wants to see a summary of the budget and time expenditures associated with a specified project, broken out by reporting period. The following settings provide added benefit:

  • The Columns settings show time and budget totals.
  • The Filter setting shows only individual status reports
  • The Group By setting organizes status reports by group according to project name and then by ending period.
  • The Totals setting performs a sum operation in each of the time and budget columns.

Team Member View   This view targets the team member who wishes to see a summary of the budget and time expenditures associated with a specified project. The following settings provide added benefit:

  • The Columns setting shows the time and budget totals.
  • The Filter setting shows only status reports that the current team member created.
  • The Group By setting organizes status reports by group according to project name.
  • The Totals setting performs a sum operation in each of the time and budget columns.

Recent Submissions View   This view targets the general audience member who wishes to see all status reports that have been recently submitted to the form library. The following setting provides added benefit:

The Filter setting displays only status reports created within the past seven days. Since it is not possible to use the Modified column in the required calculation (for example, Modified >= [Today]-7), the filter compares today's date with that of a calculated column named Newness (for example, [Today] >= Newness). The form library calculates the value contained in the Newness column during form field promotion by adding a value of seven days to the contents of the Last Modified On column (for example, = [Last Modified On] + 7). The Last Modified On column results from the promotion of the form's my:lastEditedOn field.

Note   To create a view or modify the settings associated with a view, go to the form library and click Modify settings and columns. The Views section displays a list of all current views and provides the option to create a new view. By clicking on an existing view, you can examine its settings.

Merging Forms

The Merge Forms feature of Windows SharePoint Services integrates with the Merge Forms feature of InfoPath to provide a powerful mechanism for data aggregation and comparison across one or more files present in a specific form library.

To use Merge Forms in a form library

  1. On the Merge Forms view of a form library, select or clear the Merge box to merge one or more files.
  2. Click Merge Forms to launch InfoPath. InfoPath creates a new form that merges the contents of all selected files. The selected files remain unchanged.

By clicking Merge Forms in a form library, you can do the following:

  • Importing Forms   A team member can use the Merge Forms view to import the contents of a previous status report into a new status report, effectively carrying forward the information from a previous reporting period.
  • Combining Forms   A project manager can use the Merge Forms view to merge the status reports of all team members into a single status report that can be edited and delivered to the project sponsor

InfoPath provides two levels of capability:

Default   When a form designer enables merging on the form, InfoPath allows users to merge repeating groups and elements. For example, table rows are combined into a single table, list entries are combined into a single list, and repeating text boxes are concatenated into a single text box.

Custom   When the default merge capability is not sufficient, you can create customized merge behaviors that operate directly on the underlying XML of the aggregated files. This allows InfoPath to merge data from different form templates (for example, schemas) and execute custom merge operations on any type of group or element (for example, merge a non-repeating field). The sample includes a custom merge file (agg.xsl) that tags each piece of merged data with the name of the user who contributed the information.

The sample uses a customized version of the Merge Forms view of the form library. This view allows project managers to quickly locate, view, and select all status reports related to a specific project for a specified reporting period. The following settings are of added benefit:

  • The Filter setting shows only individual status reports (where Report Type column is equal to Individual).
  • The Group By setting organizes status reports according to group first by descending Ending Period and then by descending Project Name.

Resources

The following resources provide additional information for topics covered by this article.

Solution Files

The Enhanced Status Report.zip file contains all files and code related to the solution discussed in this article. Extract the contents of the ZIP file to a folder at the root of the local drive of a server computer running SharePoint Portal Server. The resulting folder (local_drive:\SPS InfoPath WhitePaper) contains the following:

  • ReadMe.doc   This file contains the details for completing the installation of the solution.
  • Enhanced Status Report.xsn   This InfoPath form template contains the sample form discussed in this article.
  • Enhanced Status Report.stp This template defines the form library used in the solution.
  • SPS Projects   This folder becomes the root of a virtual directory for Internet Information Services (IIS). It contains the following:
    • Profile Service   This folder contains a Visual Studio .NET 2003 C# Web service project that implements the Profile Web service. The Profile Web service provides user profile information about a specified employee.
    • Project Service   This folder contains a Visual Studio .NET 2003 C# Web service project that implements the Project Web service. The Project Web service provides information about the projects related to a specified employee.
    • default.htm   This file provides a welcome page for the IIS virtual directory.
    • web.config   This file is the ASP.NET configuration file for the IIS virtual directory.

Conclusion

This article provides detailed information about how to use InfoPath and SharePoint Products and Technologies to develop integrated, form-based solutions that streamline existing information-gathering processes. It reviews the basic integration points between the Windows SharePoint Services platform and the Office System applications and discusses ways to enhance and extend the base features to create a custom solution for customers.

For more information

Microsoft SharePoint Products and Technologies

Microsoft SharePoint Products and Technologies on MSDN

Microsoft InfoPath 2003

Microsoft Office Developer Center

About the Author

Ronald Tielke is a Senior Consultant with Microsoft Consulting Services in Phoenix, Arizona.

Show:
© 2014 Microsoft