Discover CAML by examples
CAML is the SQL of SharePoint. If you will access SharePoint through its web services you will definately need to be familiar to a certain degree with CAML. You can read the documentation from MSDN, but I will tell you how to learn it through examples. And actually to create your own examples.
There are a few CAML builders out there, but if you know how to use SharePoint, you have a basic one hidden in there.
Let’s take it step by step.
- Go to your SharePoint
- Create a list
- Create a view for the list (for the sake of simplicity let’s name it
- Choose the conditions that you’re interested in for the query, let’s say all the items modified today, and save the view.
- Go to the list settings and save the list as a template
- Go to the template list library
- Download the template
- The template is actually a zip file. Rename it from
mylist.zipand extract the
manifest.xmlfile from it.
- Now open the XML file (with FireFox) and go to the element
/ListTemplate/UserLists/List/Metadata/Views/View[@DisplayName = 'My View'](the first
/ListTemplate/UserLists/List/Metadata/Views/Viewfor which the attribute
My View). Under this element you will find a
Queryelement. This is what you need, your CAML query.
manifest.xml file is also the source of some other useful stuff like the internal name of the fields (the
StaticName attribute of the