Search a CodePlex project

Project Description
A CamlQuery library and SmartQuery WebPart project.

  • Caml Query, to write caml query xml
  • Smart Query , SmartQuery Web Part and ListQuery Web Part

About the source
CodeArt.SharePoint.CamlQuery 老代码,适用于SP2007和SP2010, 将不再维护
CodeArt.SharePoint.CamlQuery2013 新代码,适用于SP2010和SP2013, 将继续维护,


2009-3-33 publish the source code.
and with the source code , the a webpart called smartQueryWebpart, use this webpart , you can add query function to any list . as following :



this is a blog entry for this webpart writed in chinese :

It's not a happy job to write caml query xml to return data from shrepoint list. So , I write the tool to make it easy.

the code example:

using Microsoft.SharePoint;
using CodeArt.SharePoint.CamlQuery;

SPSite site = new SPSite("http://jyserver:81");

SPList list = site.RootWeb.Lists"Notice";

QueryField field1 = new QueryField("标题",false); //the second parameter explain if the first parameter is a internal name.
//or : QueryField field1 = new QueryField("Title"); //"Title" is internal name.
//DateTime type field
TypedQueryField<DateTime> field2 = new TypedQueryField<DateTime>("Expires");

TypedQueryField<SPModerationStatusType> modField = new TypedQueryField<SPModerationStatusType>("_ModerationStatus", true);

//for lookup field
LookupQueryField field3 = new LookupQueryField ("Field1");

CamlExpression expr = field1.Contains("Test1");

SPListItemCollection items =
.OrderBy(expr && modField==SPModerationStatusType.Approved)

//set the fields to be returned
items =
ListQuery.Select( field1,field2 )
.Where( field1..Contains("Test1") && field2 >= DateTime.Now.AddDays(-1) )

items =
ListQuery.Select( 10 , field1, field2 ) // limit result count.
.Where( field1..Contains("Test1") && field2 >= DateTime.Now.AddDays(-1) )

items =
ListQuery.Select( field1 , field2 )
.Where( field1..Contains("Test1") && field2 >= DateTime.Now.AddDays(-1) )
.OrderBy(field2,true) //

//query items in subfolders
items =
.Where( field1..Contains("Test1") && field2 >= DateTime.Now.AddDays(-1) )



Download Source Code

  • .NET Framework 3.5
  • SharePoint2007/2010/2013

Not affiliated with Microsoft and CodePlex
To remove your project or any question, please contact us: [email protected]