Been wanting to post this for sometime, just didn’t have the time to do it.
Ever looked closely at formulae in calculated fields?
I never realized how similar formulae in calculated fields were to CAML. It’s almost a 1:1 translation.
For example look at this
Calculated Field:
=AND(Category="Books",OR([Importance]="Critical",[Importance]="Urgent"))
CAML:
<And>
<Eq>
<FieldRef Name=”Category”/>
<Value Type=”Text”>Books></Value>
</Eq>
<Or>
<Eq>
<FieldRef Name=”Importance”/>
<Value Type=”Text”/>Critical</Value
</Eq>
<Eq>
<FieldRef Name=”Importance”/>
<Value Type=”Text”/>Urgent</Value
</Eq>
</Or>
</And>
Both those are virtually the same, which leads me to assume that calculated fields are converted to CAML internally; but that’s not the important bit. The important bit is, naturally there should be something in the API similar to a parser that would convert ‘Calculated field’ formulae to CAML. In fact it might be much more usable than something I wrote.
I’m hunting for this now. Let me know if any of you find it.