Release 2.0

Rating:        Based on 3 ratings
Reviewed:  3 reviews
Downloads: 1015
Change Set: 206f0f5f71a1
Released: Aug 26, 2013
Updated: Jul 14, 2014 by omlin
Dev status: Beta Help Icon

Recommended Download

Application camljs.js
application, 36K, uploaded Aug 25, 2013 - 963 downloads

Other Available Downloads

Application camljs.d.ts
application, 21K, uploaded Aug 25, 2013 - 52 downloads

Release Notes

Bracket expressions and partial query generation

This is the main improvement comparing to the version 1.0, where you couldn't create complex queries because of lack of bracket expressions support.

Two new methods were added to the builder chain in order to support that: Any & All.

/** Adds And clauses to the query. Use for creating bracket-expressions in conjuction with CamlBuilder.Expression(). */
All(...conditions: IExpression[]): IExpression;

/** Adds Or clauses to the query. Use for creating bracket-expressions in conjuction with CamlBuilder.Expression(). */
Any(...conditions: IExpression[]): IExpression;

You can use these methods in conjunction with CamlBuilder.Expression() for creating bracket expressions, for example like this:
var camlQuery = new CamlBuilder().Where().Any(

As a side effect, you can now create parts of your query separately via CamlBuilder.Expression(), and then merge them together at some point later. Also you can use CamlBuilder.Expression() for defining CAMLQuery attribute in SPServices.

Better Intellisense

Intellisense significantly improved: now different types of fields have different sets of comparison options. Field usage is made more obvious.
  1. LookupField element improved. No more misleading "casting" of lookups to the target field types: now lookup fields expose methods Id() and ValueAs<type of field>().
  2. BooleanField element added for fields of boolean type.
  3. UrlField element added for fields of type URL.
  4. DateRangesOverlap element improved. It turns out, you cannot use this element in CSOM, because CSOM ignores QueryOptions element. But you still can use DateRangesOverlap with SPServices.
  5. UserField element improved.

Migration from version 1.0 to version 2.0

None of old elements were removed, but syntax is now more strict, thus in some cases it is possible that some migration will be necessary. Please, post your problems to discussions, if you will have any.

Also, please keep in mind that some elements were marked as deprecated:
  1. LookupIdField element marked as deprecated and will be removed in the next major release. Please, use LookupField(...).Id() instead.
  2. Membership element marked as deprecated and will be removed in the next major release. Functionality of Membership element was replaced with set of methods under UserField element.

TypeScript implementation

CamlBuilder is now implemented in TypeScript and thus can be used seamlessly by Typescript developers. Of course, you can still use JavaScript version for pure JS development.

Internally, TypeScript unit tests (tsUnit) are now used, helping to make the library much more stable. New tests are added.


CamlBuilder is now available via Nuget.


PM> Install-Package CamlJs

TypeScript definitions:

PM> Install-Package camljs.TypeScript.DefinitelyTyped

Reviews for this release

This is solid. I am using it for an Employee Directory app in o365. We have to dynamically build several queries and this saved me a lot of time. No issues thus far. Running in production with several thousand hits per day.
by joeldpalmer on Jul 8, 2014 at 8:49 PM
This is an essential for SharePoint JavaScript development projects. It's one of the first libraries I include in any new SharePoint 2010 Team Sites.
by ijmercedes on Dec 6, 2013 at 2:23 AM
It is an excellent tool for anybody who develops Sharepoint client side solutions.
by BigZolo on Dec 4, 2013 at 4:00 PM