none
Fetching Result From Multiple sharepoint lists using CAML QUERY

    Question

  • Hi,
    I need to fecth Result Set from multiple Sharepoint list at a time.As per my knowledge--we can not perform joins in sharepoint list.i need to know,how i can retrieve the result from multiple sharepoint list using CAML Query or Any other way.

    Thankx in advance
    Thursday, March 11, 2010 2:55 PM

Answers

  • Consider using Linq to sharepoint? it's probably out of supposed, but i've used it and LinQ is easier to write compared to CAML and with his tool (SPMetal) you can get strongly typed queries instead of string literals in CAML.


    Never stop learning.
    • Marked as answer by Chengyi Wu Thursday, March 18, 2010 3:42 AM
    Friday, March 12, 2010 9:45 AM
  • Performance wise, you can optimise it by selecting the "Collections" with CAML 1st (Filtering the number of results) THEN use linq to join the filtered data, there's still higher overhead compared to pure CAML, but like what you said, you can't join them. There are many best practices advice out there on how to enhance linq performance :)
    Never stop learning.
    • Marked as answer by Chengyi Wu Thursday, March 18, 2010 3:42 AM
    Wednesday, March 17, 2010 7:17 AM

All replies

    • Proposed as answer by Kshitijb Thursday, March 11, 2010 3:13 PM
    • Unproposed as answer by Mike Walsh FIN Thursday, March 11, 2010 4:04 PM
    Thursday, March 11, 2010 3:13 PM
  • You have been warned enough times.

    DO NOT PROPOSE YOUR OWN POSTS.

    This is your final warning.

    FAQ sites: (SP 2010) http://wssv4faq.mindsharp.com; (v3) http://wssv3faq.mindsharp.com and (WSS 2.0) http://wssv2faq.mindsharp.com
    Complete Book Lists (incl. foreign language) on each site.
    Thursday, March 11, 2010 4:05 PM
  • Hi! Mike 

    please you let me know who will going to propose our post as answere ..

    Thanks
    kshitij
    Thursday, March 11, 2010 7:21 PM
  • please you let me know who will going to propose our post as answere ..

    As has been explained to you several times already (and not just by me).

    *Other* people will propose your post as an answer if it is any good.

    You on the other hand propose almost everything you post - good, indifferent or bad.


    If other people propose your post as an answer (and I recognize the name as being qualified to judge the quality of a post) I will usually "up" the post to answer status.

    If people propose their own posts I will never "up" a post and will instead remove the "propose as answer".


    In the SharePoint forums there are no easy ways to get points, you need to post good replies that other people recognize as a quality answer.



    [I, as Moderator, could mark my own posts directly as an answer. I never do. I could also "up" a post of mine that someone else has proposed as an answer. I never do that either - I wait for another Moderator to see the marking and judge if my post does answer the question. The rules here apply to everyone. Including me AND including you.]

    FAQ sites: (SP 2010) http://wssv4faq.mindsharp.com; (v3) http://wssv3faq.mindsharp.com and (WSS 2.0) http://wssv2faq.mindsharp.com
    Complete Book Lists (incl. foreign language) on each site.
    Friday, March 12, 2010 4:57 AM
  • Thanks Mike for knowng me the details.


    kshitij
    Friday, March 12, 2010 9:24 AM
  • Consider using Linq to sharepoint? it's probably out of supposed, but i've used it and LinQ is easier to write compared to CAML and with his tool (SPMetal) you can get strongly typed queries instead of string literals in CAML.


    Never stop learning.
    • Marked as answer by Chengyi Wu Thursday, March 18, 2010 3:42 AM
    Friday, March 12, 2010 9:45 AM
  • hi..

    as I need to fetch Result Set from multiple Sharepoint list at a time and performance is the main issue.
    IS the LINQ is good in term of performance as the table are change on Run time...depending upon the search criteria.
    i also some post---in which they use <Joins> tag but not sure how to use and also about the performace.
    Wednesday, March 17, 2010 7:10 AM
  • Performance wise, you can optimise it by selecting the "Collections" with CAML 1st (Filtering the number of results) THEN use linq to join the filtered data, there's still higher overhead compared to pure CAML, but like what you said, you can't join them. There are many best practices advice out there on how to enhance linq performance :)
    Never stop learning.
    • Marked as answer by Chengyi Wu Thursday, March 18, 2010 3:42 AM
    Wednesday, March 17, 2010 7:17 AM
  • Hi..

    Can we use SLAM ??

    I'm new to share point ,i dnt know the exact way of retrieve data from multiple sharepoint list.
    performance is the top priority for me.
    as per the last reply...using CAML query and LINQ make the performance low.
    could any plz tell me...any way...data retrieval

    my requirement are:--
    1> retrieve data from multiple share point list(need to do join as list have lockup  field)
    2> Performance is also be the priority.
    3> data is large--so need faster mechanism

    we are using C# and accessing sharepoint site(SpList,SpQuery object).

    • Edited by Mike Walsh FIN Thursday, March 18, 2010 10:30 AM Need help ASAP. removed. These are forums. NEVER write ASAP or urgent or similar. If you are in a hurry ring MS Customer Support Services and pay for support. Here you wait.
    Thursday, March 18, 2010 6:04 AM
  • How big is your list? i remember reading from MS whitepapers that once a list collection exceeds 2000 items, the performance starts to give big problems. I've tested using a Quad Xeon 6gb memory server querying 1 list of 2 columns(text input) with 10,000 records.

    It took me more than 25s just to do a "select *". If you are trying to optimize a list with more than 2000 items, it's going to be a hard one. There are several workarounds that i know of, but i've not tested them in production environment.

    1 way is to create a folder in the list and querying the folder level, thus in theory, you can have 1999 folders each containing 1999 items and still have acceptable performance.

    It really depends on your environment and nature of data. You can start your own thread with full description of your set up and problems for us to help you :)


    Never stop learning.
    Tuesday, March 30, 2010 5:59 AM
  • Hi,

    You can also use the SPSiteDataQuery to fetch data from multiple list into a single datasource. You need to provide all the ListId and CAML query will return you a single datatable with the data from all list. It also work on different type of list.

    This link may be help you to know more about SPSiteDataQuery

    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsitedataquery.lists.aspx

    http://blog.thekid.me.uk/archive/2007/02/27/spsitedataquery-samples-for-wss-v3.aspx

    Tuesday, March 30, 2010 6:39 AM