Thursday, May 21, 2009

U2U for me

CAML (Collaborative Application Markup Language) is an XML-based query language that helps you in querying, building and customizing Web sites based on Windows SharePoint Services. i have used CAML in the past to add filters to my sharepoint views. today i have learned that it can be used together with SPQuery to for querying and updating lists via the SharePoint web service Lists.asmx.

CAML seems easy to learn at first, but when you work with real data and are presented with different data types having various inherent properties, the work becomes difficult. fortunately, CAML builders are available. the one i use mostly for my work is U2U CAML Query Builder.



U2U has helped me come up with nested filters having a slightly complex "where" clause (an AND and an OR). it has also helped me come up with a query that tells sharepoint to retrieve data where in "Assigned User = [Me]". lastly, it has helped me determine how the "approval status" column (used when content moderation is enabled) can be filtered. here's a sample query U2U has come up with in one of my programs:



referring to the above screenshot of U2U's UI, you can use U2U to build complex where clause by following these steps:

Select the field for which you want to add a second where condition. Click the Where checkbox. Immediately a combobox appears where you can select “And” or “Or”. Fill out or select a value and click the > button. Notice that a Where node is added to the CAML query.

Let me know if this helps!

No comments:

Post a Comment