http://sharepointcamlhelper.codeplex.com/
https://camldotnet.svn.codeplex.com/svn/JohnHolliday.Caml.Net/CAML.cs
CAMLManager mgr = new CAMLManager();
mgr.QueryGroups.Add(new QueryGroup("Title", Types.FieldTypes.Text, Types.QueryTypes.Eq, "A Title"));
mgr.QueryGroups.Add(new QueryGroup(Types.JoinTypes.Or, "Title", Types.FieldTypes.Text, Types.QueryTypes.Eq, "Another Title"));
mgr.QueryGroups.Add(new QueryGroup(Types.JoinTypes.And, QueryGroup.MergeTypes.Contain, "Total", Types.FieldTypes.Number, Types.QueryTypes.Geq, "2"));
string caml = mgr.GetCAML();
Will provide the following:
<Where>
<And>
<Or>
<Eq>
<FieldRef Name="Title" /><Value Type="Text">A Title</Value>
</Eq>
<Eq>
<FieldRef Name="Title" /><Value Type="Text">Another Title</Value>
</Eq>
</Or>
<Geq>
<FieldRef Name="Total" /><Value Type="Number">2</Value>
</Geq>
</And>
</Where>
https://camldotnet.svn.codeplex.com/svn/JohnHolliday.Caml.Net/CAML.cs
CAMLManager mgr = new CAMLManager();
mgr.QueryGroups.Add(new QueryGroup("Title", Types.FieldTypes.Text, Types.QueryTypes.Eq, "A Title"));
mgr.QueryGroups.Add(new QueryGroup(Types.JoinTypes.Or, "Title", Types.FieldTypes.Text, Types.QueryTypes.Eq, "Another Title"));
mgr.QueryGroups.Add(new QueryGroup(Types.JoinTypes.And, QueryGroup.MergeTypes.Contain, "Total", Types.FieldTypes.Number, Types.QueryTypes.Geq, "2"));
string caml = mgr.GetCAML();
Will provide the following:
<Where>
<And>
<Or>
<Eq>
<FieldRef Name="Title" /><Value Type="Text">A Title</Value>
</Eq>
<Eq>
<FieldRef Name="Title" /><Value Type="Text">Another Title</Value>
</Eq>
</Or>
<Geq>
<FieldRef Name="Total" /><Value Type="Number">2</Value>
</Geq>
</And>
</Where>
Spot on with this write-up, I truly think this website needs much more consideration. I’ll probably be again to read much more, thanks for that info.
ReplyDelete