countrymeister
asked on
CAML query to groupby does not work to get sharepoint list
I have a SP list that I am trying to retrieve in my silvelight project.
Please note that I am using the Microsoft.Sharepoint.Clien t.Silverli ght dll
I have a SP List called Region, which has a few columns. I am trying to get a distinct set of data from the list
Here is my code
ListItemCollection allRegions;
SP.List oList = oWebsite.Lists.GetByTitle( "Region");
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<View><GroupBy><FieldRef Name='Location_x0020__x002 0_'/></Gro upBy></Vie w>";
clientContext.Load(allRegi ons,
items => items.Include(
item => item["Location_x0020__x002 0_"] )
)
);
Please note that I am using the Microsoft.Sharepoint.Clien
I have a SP List called Region, which has a few columns. I am trying to get a distinct set of data from the list
Here is my code
ListItemCollection allRegions;
SP.List oList = oWebsite.Lists.GetByTitle(
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<View><GroupBy><FieldRef Name='Location_x0020__x002
clientContext.Load(allRegi
items => items.Include(
item => item["Location_x0020__x002
)
);
Group By only works if you also sort. Also you *may* not need the View elements.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I resolved this myself