Create new SP.CamlQuery based on camljs vew and caml query

Mar 23, 2015 at 8:33 AM
Edited Mar 23, 2015 at 8:33 AM

Could you please help me\advice if it is possible to achieve following:

one part of my code generates view query using camljs:
var view = new CamlBuilder().View().Scope(1).RowLimit(1);
<View Scope="RecursiveAll">
another part generates caml query:
var caml = new CamlBuilder().Where().TextField("MyF").EqualTo("test");
        <FieldRef Name="MyF" />
        <Value Type="Text">test</Value>
How can I combine these two parts to produce new SP.CamlQuery object using camljs?
I know that I can convert view to string parse it and insert Query tag, but I don't want to deal with it.

It will be cool If I can do var newQuery = view.Query(caml) or anything similar.
Mar 24, 2015 at 5:51 PM
Edited Mar 24, 2015 at 5:59 PM

Reusing right now is only possible via CamlBuilder.Expression().
Something like this:
var q1 = new CamlBuilder().View().Scope(1).RowLimit(1);
var q2 = CamlBuilder.Expression().TextField("MyF").EqualTo("test");
var query = q1.Query().Where().All(q2).ToString();


P.S. Parsing CAML queries and different merging scenarios is something what I actually plan to implement in next major release of the library.