QueryBasedCollection<T> QueryBasedCollection<T> QueryBasedCollection<T> Class

Definition

Represents the collection base class that provides data paging support for large collections and querying support such as sorting and filtering.

generic <typename T>
 where T : classpublic ref class QueryBasedCollection abstract : Microsoft::SharePoint::Publishing::CollectionBase<T>
public abstract class QueryBasedCollection<T> : Microsoft.SharePoint.Publishing.CollectionBase<T> where T : class
Public MustInherit Class QueryBasedCollection(Of T)
Inherits CollectionBase(Of T)
Type Parameters
T
Inheritance
QueryBasedCollection<T>QueryBasedCollection<T>QueryBasedCollection<T>
Derived

Remarks

In addition to the foreach enumeration support (For Each in Visual Basic) and Count property provided by the CollectionBase base class, this collection provides data paging support for large collections and querying support such as sorting and filtering.

You can apply sorting and filtering using Collaborative Application Markup Language (CAML), which defines a query to use in a Microsoft SharePoint FoundationSPQuery object. You must apply the CAML query when the collection is initially created or retrieved. For example, the PublishingWeb.GetPages method has overloads that take a CAML string directly, and overloads that take an SPQuery instance that has an SPQuery.Query property. You can use the CAML <OrderBy> tag to sort the collection. For example, to order a collection in ascending order based on title, use the following CAML query.

&lt;OrderBy&gt;&lt;FieldRef Name="Title" Ascending="TRUE"&gt;&lt;/FieldRef&gt;&lt;/OrderBy&gt;

The CAML <Where> tag can be used for filtering the collection.

To filter a collection based on title matching some value "abc", use the following CAML query.

&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name="Title"&gt;&lt;/FieldRef&gt;&lt;Value Type="Text"&gt;abc&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;

This collection also supports data paging, allowing subsets of the collection to be retrieved. You must specify the maximum number of objects to be retrieved in each subset when the collection is initially created or retrieved. For example, the PublishingWeb.GetPages method has overloads that take a row limit, and overloads that take an SPQuery instance that has an SPQuery.RowLimit property. The QueryNext method can be used to advance to the next subset of paged data.

Properties

Count Count Count

Gets the number of items in the collection.

(Inherited from CollectionBase<T>)
IsSynchronized IsSynchronized IsSynchronized

Gets whether the collection is synchronized.

(Inherited from CollectionBase<T>)
Item[Guid] Item[Guid] Item[Guid]

Gets an item by its unique identifier (ID).

Item[Int32] Item[Int32] Item[Int32]

Gets the item at the specified index.

(Inherited from CollectionBase<T>)
Item[String] Item[String] Item[String]

Gets an item by its Web-relative URL.

RowLimit RowLimit RowLimit

Gets the maximum number of items that can be contained in a collection that is using data paging.

SyncRoot SyncRoot SyncRoot

Gets the object that can be used to synchronize access to this collection.

(Inherited from CollectionBase<T>)

Methods

CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32)

Copies the internal collection to the specified array, starting at the specified index.

(Inherited from CollectionBase<T>)
EnsureItemIsUnique(SPListItem) EnsureItemIsUnique(SPListItem) EnsureItemIsUnique(SPListItem)

Verifies whether the current item has already been retrieved.

GetEnumerator() GetEnumerator() GetEnumerator()

Returns a generic enumerator that can iterate through this generic CollectionBase instance.

(Inherited from CollectionBase<T>)
QueryNext() QueryNext() QueryNext()

Advances the collection to the next subset of paged data.

Explicit Interface Implementations

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

Gets an enumerator that can iterate through the CollectionBase.

(Inherited from CollectionBase<T>)

Extension Methods

ToJson(Object) ToJson(Object) ToJson(Object)

Applies to