« For the love of SharePoint | Main | Apple iPhone drivers are pos »
Tuesday
Apr202010

SharePoint 2010 CAML List Joins

SharePoint 2010, you can finally do List Joins in CAML.  This would be a great boon to the type of views that you can create in SharePoint and in code.

http://msdn.microsoft.com/en-us/library/ee539975(office.14).aspx

There is a catch – it looks like the field that you can use for joins must be a Lookup type field to the foreign list.

Join type can be LEFT or INNER.

Given that LINQ to SharePoint sits on top of CAML – all the LINQ join statements will translate properly as well.

 

 

When I first started developing with SharePoint, I really hated CAML. 

In time, I’ve learnt to live with CAML, the lack of good tools drives me crazy.  But it is a necessary evil when you work in SharePoint.

Reader Comments (2)

Hi ,
after months of working in CAML and LINQ to sharepoint I identified that both of them suck.
Let me first start with LINQ to sharepoint
You cannot write Join with a condition on a pojected field
You can nnot use a multivalued join.
Not all queries get converted to caml internally...

CAML
This thing totally sucks . the querys are not too complicated. I didnot even find a xml schema to validate the xml query..

May 19, 2011 | Unregistered CommenterNVR

Haha agreed! Though SP 2010 CAML is already far better than 2007, and the joins didn't exist at all before that.

Single query projections in LINQ to SharePoint relies on the lookup column heavily, and really doesn't give you much more out of the box.

There are times where I have to rely on carefully created multiple queries to get what I want.

May 20, 2011 | Registered CommenterJohnLiu.NET

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>