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 :

http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/7a86ba74-ea19-42f3-bde9-690542c84552

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s