DISQUS

DISQUS Hello! SharePoint Magazine is using DISQUS, a powerful comment system, to manage its comments. Learn more.

Community Page

SharePoint Magazine

SharePoint Magazine is an online magazine dedicated to the world of SharePoint and related Information Worker technologies.
Jump to original thread »
Author

Writing CAML Queries For Retrieving List Items from a SharePoint List

Started by Arno Nel (SharePoint Magazine) · 10 months ago

Introduction
The Collaborative Application Markup Language (better known as CAML) is an XML-based query language that helps you querying, building and customizing Web sites based on Windows SharePoint Services. The XML elements define various aspects of a WSS site.
 In this first seri ... Continue reading »

22 comments

  • wow, great introduction to CAML from the CAML girl herself :)
  • Great article!

    I would like to point out a great tool by John Holliday called CAML.net which helps write the CAML code for you and prevents quite a lot of typo errors. It is available on CodePlex at http://codeplex.com/camldotnet/

    .b
  • Karin,
    Thank you for this posting. I've been doing a fair amount of CAML lately and have used this page as a starting point for alot of my work.

    Thanks
  • There exist a number of community tools that help you generate your CAML. Another tool is the U2U CAML Query Builder. Besides a user interface in which you can design your queries, you can also use the DLLs from within your code to generate the necessary CAML.
    Karine
  • Hi Karin,

    After successfully retrieving the records using the GetListItems method, how can I use the result so I can insert it in a SQL table?

    Thanks in advance
  • Thanks for a great post.

    Very interesting and informative overview.
  • Hello Karine,
    Thanks a lot for the wonderful post. I read the full post and just got every thing which I was looking for.
  • thank you for great article=)
  • this is the best, simple, attractive, satisfying, shortest article i have read in my life. you have an amazing way!!!!
  • ...also, be sure that authentication as enabled at endpoint... (lost a good hour there)
  • Thank you, thank you. I wish I had saw this post last week. This cleared up a lot of questions!
  • Hi

    I use the U2U caml builder gor queries and I use the shpt web services to retrieve data.

    I am facing a problem. When I want to get the data from a particular view of the list, I pass the view name of the getlistitems method and it returns me the rows belonging to that view only.

    However, when I try getting the data from a view based on a query, the query returns the data from the all items view rather than from that particular view only, and as a result I get extra rows, what should i do to prevent this?

    Thanks a lot

    Akshaya
  • My list contains folders as list items.Can anyone help how to sort folder in list.
  • Excellent introduction on CAML query creation. In real time I am facing some prolem, can any one please suggest me the solution. In SharePoint list I have 5 columns: Title, Description, submitter, status and Published Date. My query should be like:
    (Status = ‘Published’ AND Published Date=’10/10/2008’) AND (title contains ‘xyz’ OR descrition contains ’abcd’ OR submitter conains ‘aaa’)
  • How can you debug SPException "Cannot Complete this action" ? My query looks fine. But if I try to access myListItemCollection.Count I get the error
  • Hello. Thank you for the helpful article.

    I'm curious - has the method for expanding recurring calendar events over webservices been tested?

    I have been able to get it working "server-side", as described in the iCal article; however - no combination of options seems to work for expanding recurring events using the web services interface.
  • Hello, I m lookin to retrieve the direct link to a document in my CAML query result, who can I do that??
    I'm usintgSPSIteDataQuery accross multiple SubSite and use the SPWeb.GetSiteData(myCamlQuery)
    thanks in advance!
  • Hi Boske,

    This is the only place that I found this useful information about getting Calendar data throug lists.asmx webservice. But I got a problem and not sure why it behave this way. Basically, I was able to get calendar data from this month with all recurrence events. But when I click Next month, I put this code like you suggest in QueryOptions to set CalendarDate to the next month but it doesn't seem to effect anything. It's always return me the all events for the current month and upto the same day next month (e.i: if I query from today 4/21/2009, I'll get everything from April upto May 21) I can't seem to get further. Please help...

    Thanks



    XmlNode queryOptionsNode = camlDocument.CreateElement("QueryOptions");queryOptionsNode.InnerXml = "<ExpandRecurrences>TRUE</ExpandRecurrences>" + "<CalendarDate>2009-05-21T01:00:00Z</CalendarDate>";
  • Is there any (easy) way to call Lists.ASMX from an Infopath 2007 form and use the results in a dropdown?
  • Excellent post, Karine!

    This is one of the best posts that I've read on CAML. It's straightforward yet thorough. Unlike other articles that I've read about CAML, this one covers all scenarios.

    Thank you very much!
  • I am building a custom workflow in SharePoint and I ise CAML query to retrive data about status of the task. However, at one point, an error started to arise: One or more field types are not properly installed... I checked internal nemes and everything is fine. The strangest thing is that the same code worked before. What can be the cause? I would extremely appriciate your help.

    Thanks in advance
  • Not able to get Recurrence Data in the response even after adding <ExpandRecurrences>TRUE</ExpandRecurrences>
    Any suggestions

Add New Comment

Returning? Login