Skip to main content
Go Search

Ayman El-Hattab's Blog [MVP]

Ayman El-Hattab's Blog
Marwan Tarek's Blog
Mohamed Yehia's Blog

SharePoint 4 Arabs - Online SharePoint Training, Video Tutorials and Webcasts in Arabic > Ayman El-Hattab's Blog [MVP] > Posts > SPQuery to External List ignores the RowLimit attribute
SPQuery to External List ignores the RowLimit attribute

Using CAML Queries is the only supported way to query external lists. It comes in very handy If you want to retrieve external data within a sandboxed application, without using a full-trust proxy. However using CAML Queries with external lists comes with some gotchas. Consider the following snippet :

SPQuery query = new SPQuery();                               
query.Query = "<Method Name='ReadList' />" +
"<OrderBy><FieldRef Name=\"CustomerID\"/></OrderBy>" +
"<RowLimit Paged=\"TRUE\">10</RowLimit>" +
"<Aggregations Value=\"Off\"/>";

SPListItemCollection items = lstCustomers.GetItems(query);

Unfortunately, this query just ignores the RowLimit and returns all the data from the external data source and not only the first 10 items as specified in the query. This is a known issue!

For more information :


There are no comments yet for this post.
Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.


Body *