PublishingWeb.GetPublishingPages method (SPQuery)

Gets a collection of PublishingPage objects contained in this PublishingWeb object.

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

public PublishingPageCollection GetPublishingPages(
	SPQuery query
)

Parameters

query
Type: Microsoft.SharePoint.SPQuery

The SPQuery object to use when retrieving the collection.

Return value

Type: Microsoft.SharePoint.Publishing.PublishingPageCollection
A PublishingPageCollection collection containing PublishingPage objects in this PublishingWeb, based on the query argument.

ExceptionCondition
[Microsoft.SharePoint.SPException]

The collection retrieval failed. The CAML query may be invalid.

[Microsoft.SharePoint.Publishing.InvalidPublishingWebException]

The site is not valid. The Pages document library is missing.

[System.ArgumentNullException]

The value cannot be set to a null reference (Nothing in Visual Basic).

Set the RowLimit property on the query parameter to indicate the paging data size.

Set the Query property on the query parameter to indicate the Collaborative Application Markup Language (CAML) query to use when retrieving the collection.

You can use the CAML <OrderBy> tag to sort the collection. For example, to order a collection in ascending order based on title, use this CAML query.

<br/>
<OrderBy>
<FieldRef Name="Title" Ascending="TRUE">
</FieldRef>
</OrderBy>

You can use the CAML <Where> tag to filter the collection. For example, to filter a collection based on title matching the value "abc", use this CAML query.

<br/>
<Where>
<Eq>
<FieldRef Name="Title">
</FieldRef>
<Value Type="Text">abc</Value>
</Eq>
</Where>
Show: