Thursday, October 13, 2016

Camlex 4.2 and Camlex.Client 2.2 are released

I’m pleasant to announce that today new version of Camlex 4.2 and Camlex.Client 2.2 (Camlex version for client object model) were released. Camlex is free open source library for Sharepoint developers which simplifies creation of CAML queries via using of C# lambda expressions. Camlex is especially useful for creating of dynamic CAML queries when amount of conditions is not known in compile time.

Before to describe changes I need to say that credits of this release go to MarTiX codeplex user which implemented most of necessary functionality and submitted pull request to the Camlex. This is not first time when developers contribute to Camlex project and from my point of view this is great example of open source community cooperation. Thank you MarTiX for your contribution!

In version 4.2/2.2 support for LookupMulti field type was added. Now it became possible to create CAML queries which contain LookupMulti with possibility to add LookupId=”True” attribute to FieldRef like in the following example:

   1: var caml =
   2:     Camlex.Query()
   3:         .Where(x => x["Title"] > (DataTypes.LookupMultiId)"5" &&
   4:             x["Author"] == (DataTypes.LookupMultiValue)"Martin").ToString();

In result we will get the following CAML query:

   1: <Where>
   2:   <And>
   3:     <Gt>
   4:       <FieldRef Name="Title" LookupId="True" />
   5:       <Value Type="LookupMulti">5</Value>
   6:     </Gt>
   7:     <Eq>
   8:       <FieldRef Name="Author" />
   9:       <Value Type="LookupMulti">Martin</Value>
  10:     </Eq>
  11:   </And>
  12: </Where>

As usual code is available in Download section on Codepex and in Nuget:

Install-Package Camlex.NET.dll

or

Install-Package Camlex.Client.dll

There were several requests for this feature on Camlex project hosting site on Codeplex, so I hope that with new version of Camlex developers will produce more efficient code.

No comments:

Post a Comment