SPC050250: Assign RowLimit for SPQuery in limited range

Assign RowLimit for SPQuery within the limited range (default 1 to 2000).

TypeName: AssignSPQueryRowLimitInLimitedRange
CheckId: SPC050250
Severity: CriticalWarning
Type: AssemblyFileReference

The RowLimit property is used together with the ListItemCollectionPosition property to define paging in a query. See sample below:

using (SPWeb oWebsiteRoot = SPContext.Current.Site.RootWeb)
   SPList oList = oWebsiteRoot.Lists["Announcements"];
   SPQuery oQuery = new SPQuery();
   oQuery.RowLimit = 2000;
   oQuery.Query = "<OrderBy Override=\"TRUE\"><FieldRef Name=\"FileLeafRef\" /></OrderBy>";

Rule Configuration
Name Description
MaxAllowedSPQueryRowLimit Integer with maximum allowed RowLimit for SPQuery. Default: 2000

comments powered by Disqus