Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

The CAML query to pull say 3 items based off of the following requirements seems pretty starightforward:

  1. Title is not null

  2. Expires(Expiry Date) is greater than or equal to Today

  3. Order Created in Ascending

  4. spQuery.RowLimit =3;

However how do I modify the Query to obtain the next three in the list preserving all my previous filters and order bys?? Thanks

enter image description here

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

To achieve this, You can use ListItemCollectionPosition property. It is used together with the RowLimit property to define paging in a query.

For your reference, see the sample code available this link http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spquery.listitemcollectionposition.aspx

I hope this will resolve your problem.

share|improve this answer
add comment

Paging in SPQuery is implemented through the class SPListItemCollectionPosition. The SPListItemCollection returned by SPQuery.GetItems contains a ListItemCollectionPosition property which is null if no more pages and otherwise can be used assigned to the corresponding property in SPQuery before a new call to GetItems. (Sample at the link above)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.