2

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

6

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.

4

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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