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)

Syntax

'Declaration
Public Function GetPublishingPages ( _
    query As SPQuery _
) As PublishingPageCollection
'Usage
Dim instance As PublishingWeb
Dim query As SPQuery
Dim returnValue As PublishingPageCollection

returnValue = instance.GetPublishingPages(query)
public PublishingPageCollection GetPublishingPages(
    SPQuery query
)

Parameters

Return value

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

Exceptions

Exception Condition
[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).

Remarks

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.

Examples

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>

See also

Reference

PublishingWeb class

PublishingWeb members

GetPublishingPages overload

Microsoft.SharePoint.Publishing namespace