.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

caml query groupby Sharepoint 2010

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :C#


I am trying to programmatically access data from a Sharepoint 2010 document library specifically these are promoted fields created by Infopath 2010 form using a CAML query. There is a condition in the where statement, a groupby is required and only want the column specified in the groupby to be returned.
As the are promoted fields from an infopath form I am using the internal name as well. I have three rows of data:
Year  Round Accepted (plus several more columns not relevant for this query)
2012  1     No
2012  2     No
2013  1     No
My expected results would be only two rows returned:
However, what is returned is 3 rows of data. What am I doing wrong? Any feedback or suggestions much appreciated.

BTW I have tried using U2U CAML builder but there is no groupby.

SPList claimsList = claimsSite.Lists["Claims"];//get the library list of claims
SPField fldAccepted = claimsList.Fields["Accepted"];
string strAccepted = fldAccepted.InternalName;
SPField fldYear = claimsList.Fields["Year"];
string strYear = fldYear.InternalName;
SPField fldRound = claimsList.Fields["Round"];
string strRound = fldRound.InternalName;

View Complete Post

More Related Resource Links

CAML Query for display Top n records in sharepoint 2010


Hi friends,

I have added the Content Query web part in my publishing page for displaying data from list.

Now i want to use additional filter option from content query web part.

pls tell me wht query i should write for returning Top n Records from list.

also pls tell me whole caml query format dat i need to put in custom value or query option in additional filter option in Content Query Web Part

Content Query Web Part missing in SharePoint 2010

If you don't see content query web part listed in the web parts list, this is because you have not enabled "Search Server Web Parts" feature in site collection features. Enable this feature and content query web part will show in the list of web parts.

How to join two sharepoint list in c# by CAML query?

Hii All,
   I am using wss 3.0 and i have one site and site has 4 to 5 lists. lists are interconnected with lookup column and same column. I need to display some column fron one list and some from another.. i need to join that lists by where condition like project =project..

So how can i join??

Thank You

Video: SharePoint 2010 Lists, List Data, and CAML

This demonstration illustrates how to work with list data and the Collaborative Application Markup Language (CAML). (Length: 5:05)

Video: Accessing SharePoint 2010 Data in Silverlight by Using CAML

This demonstration shows how to use the client object model and CAML to access SharePoint data in Silverlight applications. (Length: 6:39)

query w.r.t to SharePoint 2010 Performance Planning & Extranet Topology

  1.      Which extranet topology to go with in case of exposing Intranet to Remote Employees / Partners ?   My understanding:   There are 3 extranet topologies : Edge Firewall , Back to Back , Split back to back   If Scenario is : a)      Only Employees needs to access Intranet from Home ,we can go for Edge Firewall b)      If partners & Employees , both needs to access Intranet ( it will have some partner sites ) , then we can go for Back to Back OR Split back to back .   Questions: ·         Is Understanding correct ? ·         Is there any factor which can help in making a decision between Back to Back Or Split back to back ?   2.      As part of sizing , I read that we should capture following information -          What should be maximum acceptable CPU utilization in production servers ? ( Example : 70%) -          What will be the concurrent number of users accessing portal during peak hour of a day ? ( Example 1000 users from total of 18000 users ) -          How many request per second are done to portal

Sharepoint 2010 FullTextSqlQuery query problem with where condition

Hello, i´m developing a webpart under Sharepoint 2010, i need to launch some different query´s to filter data but i´m having problems. First of all, i launch this query and i get all the users; SELECT PreferredName, LastName, Department, OfficeNumber, JobTitle, WorkEmail, PictureUrl FROM Scope() WHERE ("scope" = 'Personas') ORDER BY "Rank" DESC with that results i fill different dropdownlist with each of the columns, then I can filter for each column. For example: I filter by PreferredName, Lastname or WorkEmail, with this query SELECT PreferredName, LastName, Department, OfficeNumber, JobTitle, WorkEmail, PictureUrl FROM Scope() WHERE ("scope" = 'Personas') AND (("LastName" Like '%MOSS%')) ORDER BY "Rank" DESC But when i try to use the columns Department, OfficeNumber and Jobtitle every query returns 0 rows. SELECT PreferredName, LastName, Department, OfficeNumber, JobTitle, WorkEmail, PictureUrl FROM Scope() WHERE ("scope" = 'Personas') AND (("Department" Like '%Dirección%')) ORDER BY "Rank" DESC The main thing is if i get all the data i see that these columns (officeNumber, Jobtitle, Department) are not empty. Some of them have values some of them don´t. All the columns have the property "Reduce storage recquirement for text propert

Query server not responding in SharePoint 2010


When I try to search anything in SharePoint 2010 site its showing

Internal Server Exception.

So when i looked into the Central administraion page ->Manage Service Applications->Shares Services-Search Service:Search Administraion it is showing "Query server not responding (4eb29e88-2523-4f3a-9a7b-4a96d33e570e-query-0)"

Anyone please help me to solve the search error


Setting SharePoint 2010 Form Fields Using Query String Variables


Hi All,

I have a requirement to populate sharepoint form field value with query string while uploading document to document library.

While uploading the document to document library, I want to populate claim number available from query string in a pop up page i.e in my case EditForm.aspx, Located at http://servername:port/sitename/documentlibraryname/forms/EditForm.aspx.

Additional Information:

  • Created document library and added custom columns like claim number etc..
  • Created a view to filter uploaded documents as per claim number.

Server Details:

  • Windows Server 2008 R2
  • SharePoint 2010
  • SQL Server 2008 R2

I have written javascript for the same, but not sure where exactly to add the code in EditForm.aspx page.

Any help on this would be greatly appreciated.

Thanking you in advacne.



Inconvenient SharePoint 2010 Content Query Web Part and Anonymous Access


Morning every one

I am hoping some one has found a work around regarding this.

I am using a JQuery random 'quote' generator (http://nextconnect.blogspot.com/2009/12/jquery-random-quote-viewer.html) in my site.I have enabled full anonymous access. My issue is that it still prompts you for the login in order to see the quote generator. I have tried the "ViewFormPagesLockDown" fix but it isn't even activated on my site. And now I am at a complete loss. I did some googling (Read 5 hours) and it seems that in Sharepoint 2010 doesn't have a work around for this and I am really hoping I am wrong.


Any ideas?


Have a great friday :)


Content Query Web Part Sharepoint 2010 AND Customize the data presentation


In fields to display you have a Title field. We will like to show two columns (Section Name and Status) in the title field, but only the fist one is displayed in the result.We use this syntax:

Column [Group];Column [Group]

When I use this formula

Section Name [Agresso R&D Base Columns] ; Status [Agresso R&D Base Columns ]

in the title field, the Section Name is displayed, and no Status, When I use this formula

Status [Agresso R&D Base Columns ]; Section Name [Agresso R&D Base Columns] ;

in the title field the Status field is displayed, and no section name. Is this a bug? or is it an other way to show both columns in the title field?


Fields to display Depending on the scope of your query, you can select one or more site or list columns whose values you want to show in the display slots for this style. To specify a column from a particular group, type the name of the group in square brackets after the column name, for example, Column [Group]. Be sure to separate each column you enter with a semi-colon.


SharePoint 2010 sql search query issues



I am using tool for testing SharePoint search queries (http://blogs.technet.com/b/speschka/archive/2010/08/15/free-developer-search-tool-for-sharepoint-2010-search-and-fast-search-for-sharepoint.aspx). I have tested some queries and received some strange results. For example:


SELECT Size, Rank, Path, Title, Description, Write, Filename, FileExtension FROM scope() WHERE CONTAINS (Title, 'get') ORDER BY Rank DESC

This query returns two results for me. And next one returns no results.

SELECT Size, Rank, Path, Title, Description, Write, Filename, FileExtension FROM scope() WHERE Title LIKE '%get%' ORDER BY Rank DESC

However I was expecting to receive two or more results.


Another example is:

SELECT Size, Rank, Path, Title, Description, Write, Filename, FileExtension FROM scope() WHERE FileExtension = 'txt' ORDER BY Rank DESC

This query returns one result for me. And next one returns no results.

SELECT Size, Rank, Path, Title, Description, Write, Filename, FileExtension FROM scope() WHERE CONTAINS (FileExtension, 'txt') ORDER BY Rank DESC

I was expecting at least one result from this query. I would like also to mention that issue #2 is reproducible for FileExtension property only.

Could anyone please help me with these issues. Thanks beforehand for any help.


Caml Query to fetch the data from Sharepoint List for a specific date.



I have a sharepoint list with one of hte columns being Created Date of Type DateTime and value allowed is OnlyDate.

The submitted date in my column is 05/18/2011. When I perform a search using the below CAML query, it does not give any results though I have two items with this date.

<Where><Eq><FieldRef Name='Date_x0020_Created' /><Value Type='DateTime'>5/18/2011</Value></Eq></Where>

I dont understand what is wrong with this query. Someone please help

Janaki Thakur

Short Overview of SharePoint Features in Visual Studio 2010

As you probably know, Visual Studio 2010 was announced earlier this week and it contains a lot of cool features and project templates for SharePoint developers. Below is a short overview for some of the SharePoint development related features and project templates.

How to get more information about the exceptions that can happen in SharePoint 2010 projects?

In case there is an exception anywhere in the SharePoint 2010 project (most common place an exception would happen is during deployment of your SharePoint project, custom deployment configuration or custom deployment steps), there's a registry key EnableDiagnostics available for you to use.

InfoPath 2010 cannot connect to SharePoint 2010

You have installed Office 2010 beta and you are trying to connect to SharePoint 2010 from InfoPath but you get an error

Installing and configuring SharePoint 2010

The following steps show how to install SharePoint 2010 on VMware workstation 7.0. Host computer used during the preparation of this walk-through was a Vista (32-bit) machine and guest machine used was VMware workstation 7.0 with Windows Server 2008 Service Pack 2 (64-bit).
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend