InfoPath SharePoint Performance - Web Service Data Connections - SharePoint Development & Administration + InfoPath

Friday, November 19, 2010

InfoPath SharePoint Performance - Web Service Data Connections

InfoPath provides a rich set of capabilities for integrating with SharePoint.  This includes the ability to easily configure data connections to retrieve or submit data to SharePoint without the use of code.  When the lists and libraries being queried from InfoPath become large, the InfoPath form can become slow when working with the results from data connections.  This is more apparent if the form is being displayed in a browser using InfoPath Form Services, at the results of the query must be rendered into HTML, sent to the client and updated in the browser.

Many of the solutions that I have built in the past required variation to the process depending on if data exists in SharePoint, or if the data falls within specific ranges or explicit values.  To do this, code was used to loop through the results of the secondary data sources to find the required records.  This can become slow very quickly once there are a large number of documents of items in the SharePoint lists and libraries.

There are a number of methods that can be used to improve the performance of InfoPath forms that are integrated with SharePoint.  If using the data connection wizard to create connections to SharePoint, the results of the selected lists will include items displayed in the default view of the list in SharePoint.  This means that filtering, an appropriate sort order and item limit can be applied to reduce the number of items that are retrieved by the data connection from InfoPath, but you need to ensure that the criteria applied will always display the correct items from the list.  If a SharePoint list item that is required by an InfoPath form is not displayed in the default view of the list, the items won’t be included in the result set when the data connection is executed.

An alternative approach may be to configure specific queries to the Lists web service on a SharePoint site.  This allows for much greater functionality and control over the manipulation of data and the configuration of lists, sites, permissions, groups and much more.  In terms of performance, configuring a query to the Lists Web Service can be done by including specific criteria that is then used to return a specific result set will take less time than returning and looping through results to find the relevant items.  For a list or library with many items (1000+), retrieving all items, the looping through the results to find one specific item will slow the process considerably as it takes time to retrieve the large result set, as well as to iterate through it.  If instead, a query is constructed with the same criteria used to find the list item when looping through the data source, then passed to the GetListItems method of the Lists Web Service, only the one item will be returned (if exists) in much less time.  As there is only one record in the result set containing the required list item, the loop is no longer required which will further increase the performance of the InfoPath form.

Share this article:
Stumble This Delicious
submit to reddit

No comments:

Post a Comment