What's New: List Enhancements

Applies to: SharePoint Foundation 2010

Microsoft SharePoint Foundation 2010 adds features to the list infrastructure that improve user experience in the case of large lists, and that enhance data integrity.

Large Lists

In enterprise deployments of SharePoint Foundation, list content can often grow into such large collections that, when users access that content through standard operations, the performance of the site diminishes. The new List View Threshold feature addresses this issue by allowing you to specify a maximum number of list items that a database operation can retrieve. If a query exceeds the threshold, the query is blocked because it would adversely affect site performance.

Properties of the SPWebApplication class allow you to set request throttling for operations that return list items. For example, the MaxItemsPerThrottledOperation property specifies the maximum number of items that can be affected by a query or list update; if the number is exceeded, the operation is cancelled. The EnableThrottling property of a list object specifies whether throttling is applied to the list, and SPQuery and SPSiteDataQuery each have a RequestThrottleOverride property. The SPFieldIndex class represents a compound index over one or two fields in a list, which provides support for efficient list item queries that filter by using the fields.

For information about the large list feature, see Handling Large Folders and Lists. For information about how to throttle requests, see Request Throttling.

Referential Integrity for List Items with Lookup Columns

In previous releases of SharePoint Foundation, you could create a loosely defined relationship between lists through a lookup field, where a child list looks up to a parent list. In SharePoint Foundation 2010, items in the parent list are inherently "aware" of related items in the child list, and you can set referential integrity constraints on the child items by specifying a delete behavior. You can define list relationships and specify delete behavior through the user interface or through the object model.

The SPRelatedField class represents a relationship between fields in two lists. You can get a collection of SPRelatedField objects by calling the GetRelatedFields() method of the SPList class. The SPRelationshipDeleteBehavior enumeration is used to specify a deletion constraint: Cascade delete, where deleting a parent list item also deletes all related child items in one transaction; Restrict delete, where an error message is displayed if a user attempts to delete a parent list item with child items that look up to it; or None, which means no delete behavior is enforced (default value). You set a delete behavior through the RelationshipDeleteBehavior property of a lookup field, which is represented by an instance of the SPFieldLookup class.

For more information, see Lookups and List Relationships.

Enforcing Unique Column Constraints

With SharePoint Foundation, you can now provide a primary key on column fields by using (or "enforcing") a new feature named unique column constraints. You can use this feature to enforce uniqueness on values in a list or document library column. Note that not all column types support this feature. See Enforcing Uniqueness in Column Values for lists of supported and unsupported column types.

To support uniqueness constraints, a column must be able to be indexed. Furthermore, when uniqueness is enforced on a lookup column, the list item in the target list can have at most one list item looking up to it from the child list (the list where the Lookup column lives). In other words, uniqueness is not enforced on the projected column of the target list but rather on the ID column.

This feature can also be used programmatically by using a new property on the SPField object named EnforceUniqueValues. The property gets and sets a Boolean to specify whether duplicate values are allowed; the default is to allow duplicate values, so you must explicitly set a column field property EnforceUniqueValues to true.

External Lists

Microsoft Business Connectivity Services (BCS) introduces the external list, which allows you to access external data in the same way that you access SharePoint Foundation list data. Users can interact with an external list in the same way they interact with other SharePoint lists. For information about external lists, see Building Block: External Content Types and External Lists.

See Also


Building Block: Lists and Document Libraries

Handling Large Folders and Lists

Enforcing Uniqueness in Column Values

Lookups and List Relationships