CAML is Here To Stay


I did three presentations at last week's Book Publisher's Summit, talking to publishers and authors on topics that would be great for developer-focused books on SharePoint Products, namely (a) programming with lists and libraries, (b) site definitions, and because the topic will be alive for quite some time, (c) Web Parts (today's technology, not the Whidbey stuff).

I'll post on libraries and Web Parts shortly.  I want to respond to something I heard someone say when I was talking about site definitions.  Part of a good custom site definition is one or more good custom list definitions.  Good custom list definitions require doing some work in CAML (Collaborative Application Markup Language), our XML-based means of accessing and rendering the contents of SharePoint lists.

This guy said that the buzz on the street is that CAML's days are numbered.  Sorry.  Not true.

CAML is just too useful to kill.  It covers both data and rendering instructions.  It lets our List Viewer Web Part fetch a list and its rendering instructions in one step and then only have to apply the rendering to the data.  It's blazingly fast.  It's also backward compatible with everything we've done to date.

Personally, I'd enjoy synching up with other camps and switching from CAML XML to ADO.NET XML for data, and from CAML XML to XSLT for rendering.  But we have many, many other things to get done. (Do you really want this more than per-item security, synchronous events on libraries and lists, and easier deployability?  These is what I get asked for most often.)

Actually, if someone wants such things that badly, they can code them into a custom Web service and add it to our environment.  CAML is one of the ways we perform so well.  It's XML.  We -- and you -- can do a lot with it.  We're keeping it.

What we need to do is provide lots and lots of examples on CAML.  We need to stop ignoring it and start making it a normal part of SharePoint site development.  I'm working on making that happen.

But of course, this is just my opinion -- I could be wrong.  What do you think?


Comments (26)

  1. There were seven examples of how to use CAML in the STS SDK. One of those was a duplicate (in effect) so there were really six, however them being there at all helped me to start using CAML in earnest with STS (Note: for the very basic stuff building on those examples).

    In WSS I’ve had the (obviously – from your message – wrong) impression that we’d moved on from CAML. At least as far as using it to *amend* sites was concerned.

    Was that because there were no (or not enough) CML examples in the WSS SDK ? I don’t know because I’ve never managed to get that far in the WSS SDK.

    Unlike in the early STS phase I’ve had other things to do 🙂

  2. Nik Lawes says:

    Hi Mike,

    I too am another guy who is hoping CAML’s days are numbered, not because i’m really looking for its removal, but because right now when it comes to promoting "familiar tools", Microsoft have had a tendency to forget portal and other web related developers who want to use Visual Studio .NET rather than Frontpage!

    CAML enables Microsoft to do a whole bunch of cool stuff, such as tying in Frontpage to WSS. That’s great and I can understand why Microsoft would want to leave it in.

    However I believe it is more important for Microsoft to release SharePoint vNext with Microsoft Partners in mind as much as Frontpage users.

    When it comes to implementing CMS/SPS for a customer, partner, or employee based portal – whether this is for communicating, collaborating or streamlining business processes – the most common requirement will be some form of customisation.

    Without a .NET alternative to CAML, I think Microsoft Partners struggle to delivery projects to meet or exceed customer requirements, so you have to ask what is it exactly that CAML does that you can’t also do with .NET, XML, XSLT and T-SQL?

    MCMS Rapid is a good example today of how these technologies provide Microsoft and its Partners with a realistic starting point for implementing CMS.

    While I am sure Microsoft is well aware of what Partners and Customers are asking for, I would strongly encourage you not to release vNext without making it the number one priority to enable .NET developers to customise SPS/CMS templates and definitions in Visual Studio quickly and easily. Any .NET developer can go File | New Project but by then there’s no alternative but to fiddle around in CAML to do a job .NET does much better.

    Please stay true to .NET in vNEXT!

  3. Nik Lawes says:

    Mike,

    My email address is nik.lawes@imgroup.com in case you want to reply. Cheers, Nik

  4. Snorrk says:

    Totally agree.

    With CAML being XML you should be able to make tools that allow people to more easily write CAML (preview changes, templates etc.).

    I think that would be more valuable to SharePoint developers than getting something completely new and immature.

  5. Will you guys be adding a schema for CAML – this would make it much easier to learn and code with.

  6. SimonT says:

    Hate it.

    Hate the whole idea.

    Havent done that much with it though which is probably how I formed the opinion. Like the child who wont eat that new food you spent ages cooking.

    The best thing I’ve seen regarding CAML is having to use it to retrieve data when coding on the object model, are they sick ? Did years of ADO and its development just fall by the wayside.

    As for lots of examples, yes today please !.

    How about a shed load more documentation on sharepoint full stop. How about example code in the object documentation. How about "why you would do things in this manner", type documentation instead of all the "How" type documentation.

    I loathe and love this product.

  7. abc says:

    My good Signor Fitzmaurice,

    Thanks for the post. I’d appreciate more specifics.

    > We’re keeping it.

    1. Who’s "we"?

    2. Are you implying there are some sort of harmonious relationships between CAML XML and ADO.NET XML, and CAML XML and XSLT being nurtured?

    > What we need to do is provide lots and lots of examples on CAML.

    > I’m working on making that happen.

    Any dates? Are these going to be KB’s, podcasts or videocasts or what?

    > this is just my opinion — I could be wrong.

    I’m a tad confused, now. What are you unsure of? The future of CAML?

  8. RobertK says:

    🙁 And we where hoping in 2007 it would be replaced by XAML (or something similar)

  9. Gary Bushey says:

    Are there any other products outside of the SharePoint realm that use CAML?

  10. cseg says:

    The CAML concept is not bad. CAML needs good design tools but by the moment it does not have. Totally agree.

  11. Brian says:

    Here is a simple request. I can create a list in wss site and customise it to my hearts content. Once done, I can use owssvr.dll?cmd=ExportList to extract the schema. Why is it that when I paste the generated Xml into a file called schema.xml does this cause wss to fall over.

    We need a tool to massage this output into a schema.xml file that does not break wss.

    Please point me (and others) in the direction of a solution.

  12. Gary A. Bushey says:

    I have been trying to make even just a basic schema file from the SDK and came to a major problem, the CAML fields just are not documented correctly. For instance, if I start with the "Data" element I can traverse down through the children elements until I get to the "DisplayPattern" element which does not list any children. However, if I look at the "IfEqual" element the example shows it as being a child of the "DisplayPattern" element. Gets very confusing. =)

  13. FitzBlog says:

    Comments like "Unless of course you want to use them next year" made in reponse to my posting…

  14. Bad CAML says:

    CAML is just bad – there are virtually no tools, its undocumented beyond belief, and there are no *standards* backing it or momentum to do so. Why do we always have these silly one-off MS implementations? Have you guys learned nothing from proprietary [fill in the blank – there are hundreds of choices]?

    You know how hard it is to find a good ADO.NET resource? Not very. To find a good XML/XSL resource? Somewhat difficult, but they’re out there. Find a CAML resource? Do they exist? Have you ever seen one? Ever tried to hire one on short notice?

    You guys keep acting with this monolithic "gotta have features" mentality, while forgetting that no matter how much you put in there, people will always want to modify whatever you come up with. Why do you make it so ridiculously difficult?

    And please, save the "backwards compatibility" story. There’s maybe three people on the planet outside of Microsoft who have a big investment in CAML. Hope you guys will be very happy together.

  15. Anonymous says:

    CAML? What’s that?

    I’m more familiar with open (or at least common) standards for programming on the .NET platform – like using the managed classes for ADO.NET, XML, and XSLT.

    Thanks Fitz for being devoted to solving a problem that doesn’t push the SharePoint technology stack into the mainstream with the rest of .NET.

  16. Anonymous says:

    I’m trying to figure out how/if you can create conditional formatting through CAML. Example:

    how can you modify the tasks list defintion so that all the overdue items show up in red. Because this requires an inequality check (due date<today) I thought I can do something like:

    <IfEqual>

    <Expr1>

    <Lt>

    <FieldRef Name="DueDate" />

    <Value Type="DateTime">

    <Today />

    </Value>

    </Lt>

    </Expr1>

    <Expr2>TRUE</Expr2>

    <Then><HTML><![CDATA[color: #b31b34;]]></HTML></Then>

    <Else></Else>

    </IfEqual>

    But this is not working. From what I can tell the <Lt><Gt> elements can be used only within <Query>. If that’s the case how can you use inequalities in CAML?

  17. CAML.NET – Simple yet Brilliant

Skip to main content