redman
redman

Reputation: 2165

Limit groups in Sharepoint 2010 list view

How do you limit groups displayed on a Sharepoint 2010 list view with CAML?

<Query>
  <GroupBy Collapse="FALSE">
    <FieldRef Name="MyField" Ascending="FALSE" />
  </GroupBy>
  <OrderBy>
    <FieldRef Name="MyField" />
  </OrderBy>
</Query>

I want to display only first 3 groups. Is it possible to do that with CAML?

Upvotes: 0

Views: 2396

Answers (2)

markov00
markov00

Reputation: 100

if you want to limit rows returned by caml query use this :

SPQuery qry = new SPQuery();

qry.RowLimit = 3;

string camlquery = " ";

qry.Query = camlquery;

Upvotes: 0

djeeg
djeeg

Reputation: 6765

I exported a view with sharepoint designer and it has

<Query>
  <GroupBy Collapse="FALSE" GroupLimit="3">
    <FieldRef Name="MyField" Ascending="FALSE" />
  </GroupBy>
</Query>

But it isnt in the schema

http://msdn.microsoft.com/en-us/library/ms415157.aspx

Upvotes: 1

Related Questions