SPQuery Based Joins In SharePoint 2010

While working with a client today on some SharePoint 2010 code, the requirement can up to do some query based joins. I hadn’t done this before in SP 2010, but it’s pretty sweet. The only way I have gotten around it in previous versions was converting the list data into data tables and then working with it in that format. Natively working with it is a whole lot less code, whole lot less complicated too. Even for permanent join type stuff, you can use projected fields which is really nice.

So, what’s it look like? Consider the following snippet:



Pretty easy!


One Comment

  1. decatec says:

    you can usa LINQ to do joins, it’s easier IMHO, CAML can be used as a filter


  1. SharePoint 2010: Recopilatorio de enlaces interesantes (VII)! - Blog del CIIN - [...] SPQuery Based Joins In SharePoint 2010 [...]

Leave a Reply

Your email address will not be published. Required fields are marked *