Alternative to Caml string building

Hi,
I’ve been using a nice Caml Builder that is used by the U2U Caml Builder(The most popular tool among the SharePoint developers) .

Its very easy to use and in my opinion a lot more secure and efective than manual writing the CAML.

For example if i want to do a simple query to get an item by a column, i’ll do something like this:
CamlBuilder batchBuilder = new CamlBuilder(CamlTypeEnum.GetListItems);
batchBuilder.AddWhereField("", DataTypeEnum.Text, CamlOperatorEnum.Eq, CamlCombinerEnum.And, out addCombinerTag);
SpWsListsProxy.GetListItems(listName, string.Empty, batchBuilder.QueryNode, null, "1", null, null);

Note: I’am not disposing the proxy for simplicity of code
In "batchBuilder.QueryNode" it will be the query xml without errors and it is assured that it will work…
If you want you can do a reverse engineer on the dll and copy the code to your own sharepoint framework if you like, it is no ofuscated…

For more information:
http://www.u2u.info/Blogs/karine/Lists/Posts/Post.aspx?List=d35935e0%2D8c0e%2D4176%2Da7e8%2D2ee90b3c8e5a&ID=13

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s