SPWorkItemCollection class

A collection of SPWorkItem object instances. Derives from Microsoft.SharePoint.SPBaseCollection.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public class SPWorkItemCollection : SPBaseCollection

The SPWorkItemCollection class is used in conjunction with the SPWorkItemJobDefinition class, and clients that implement the Microsoft.SharePoint.ISPWorkItemHost interface. Classes derived from SPWorkItemJobDefinition are designed to be driven by the SPTimerService. The SPWorkItemCollection class uses a SQL query to filter work items before queuing them in batches for processing. Work item collections are homogenous by type. That is, each SPWorkItemCollection object contains work items of only one WorkItemType.


There are two primary hosting classes that you can use to process work items: SPSite and SPContentDatabase. Using SPSite as host gives you greater flexibility; using SPContentDatabase allows you to use the SPWorkItemJobDefinition class to process work items at the broadest scope possible—the scope of the content database.

The SPWorkItemJobDefinition class is useful only for processing work item collections and uses the GetWorkItems method to process at one time all of the site collections (SPSite) that are in the content database.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.