Is there an equilivant to GetCommand in LINQ to SharePoint? I know about ctx.Log, but I'm looking for something to retrieve the CAML from a LINQ statement without executing it.

2 Answers 2


Yes, as described in How to: View CAML Generated by LINQ to SharePoint, you just need to access the DataContext.Log property.


If you want to view your CAML query without deploying and executing the code, you can use LINQPAD with the SharePoint 2010 Data Context Driver (from Codeplex). If you scroll down on the linked documentation page, you see that the CAML is generated under the SQL result tab.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.