PublishingWeb.GetPublishingPages method (String, UInt32)
Gets a collection of PublishingPage objects that are contained in this PublishingWeb object.
Namespace: Microsoft.SharePoint.Publishing
Assembly: Microsoft.SharePoint.Publishing (in Microsoft.SharePoint.Publishing.dll)
Syntax
'Declaration
Public Function GetPublishingPages ( _
camlQueryXml As String, _
rowLimit As UInteger _
) As PublishingPageCollection
'Usage
Dim instance As PublishingWeb
Dim camlQueryXml As String
Dim rowLimit As UInteger
Dim returnValue As PublishingPageCollection
returnValue = instance.GetPublishingPages(camlQueryXml, _
rowLimit)
public PublishingPageCollection GetPublishingPages(
string camlQueryXml,
uint rowLimit
)
Parameters
camlQueryXml
Type: System.StringThe CAML query XML that is used to determine sort order, filtering, and other properties for the PublishingPageCollection collection.
rowLimit
Type: System.UInt32The maximum number of items (rows) to return each time the PublishingPageCollection is retrieved.
Return value
Type: Microsoft.SharePoint.Publishing.PublishingPageCollection
A PublishingPageCollection containing the first nPublishingPage objects in this PublishingWebclass, where n is the rowLimit value sorted and filtered based on the camlQueryXml 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. |
Remarks
This method gets PublishingPage objects for this PublishingWeb class based on the query information provided in the camlQueryXml argument. It returns only the first nPublishingPage objects in this PublishingWeb where n is the rowLimit value.
The camlQueryXml argument passed by this method is equivalent to the Query property in Microsoft SharePoint Foundation.The rowLimit argument is equivalent to the RowLimit property in SharePoint Foundation.
You can use the QueryNext() method of the returned collection to retrieve the next n items in the collection where n is the rowLimit argument value. The QueryNext() property returns the rowLimit value set here.
If the rowLimit value is zero, then all PublishingPage objects for the PublishingWeb class are retrieved when the PublishingPageCollection is created. The same is true if the rowLimit exceeds the maximum number of PublishingPage objects in the PublishingWeb class.
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>
<br/>
You can use the CAML <Where> tag to filter the collection. For example, to filter a collection based on the title matching the value "abc", use this CAML query.
<br/>
<Where>
<Eq>
<FieldRef Name="Title">
</FieldRef>
<Value Type="Text">abc</Value>
</Eq>
</Where>