This project is read-only.
  1. Prerequisites
    • Download the most current release of LinqPad for .NET 3.5 (NOT 4.0)
    • Make sure you are running LinqPad on a box (or VM) which is running SharePoint 2010 (Foundation or full blown server)
    • Required SharePoint Assemblies are assumed to be in the SharePoint installation folder, which is typically %CommonProgramFiles%\Microsoft Shared\Web Server Extensions\14\ISAPI. To determine the correct path the driver uses Microsoft.SharePoint.Utilities.SPUtility.GetGenericSetupPath.
  2. Installation
    • The driver shoud be available via LinqPad driver gallery in the future 
    • Since then just click "Add connection/view more drivers/browse to install the driver directly
  3. Choose either the static or the dynamic one
  4. Start Linq'in around

Running the dynamic driver: 

  1. Connect to your SharePoint Site
  • Start LinqPad
  • Click  "Add connection"
  • Select "build a typed data context automatically"
  • Select "Dynamic SharePoint 2010 Driver
  • Click Next
  • Enter the Url of the SharePoint Site to automatically build a data context type (derived type of Microsoft.SharePoint.Linq.DataContext)
  • The driver uses SPMetal behind the scenes to generate the code and compiles it to an assembly. Check "View SPMetal Output" to show any output (not the code) of the tool
  • To view the generated code of SPMetal go to the driver folder which is typically in 
    %systemdir%\ProgramData\LinqPad\Drivers\DataContext\3.5\LinqPadSP2010ContextDriver (3e155b134cdb8cbe)

Running the static driver:

  1. Create SharePoint Entities
    • This can be done either manually or via SPMetal
    • For simplicity it is recommended that you use the SharePoint Data Context Demo Project
    • Using the Demo Project
      • Edit runspmetal.bat to adjust the url of your SharePoint Site to fetch the entities from, change the namesspace of the generated code and so on
      • Edit SPMetal.XML to specify which entities to fetch
      • Enable the Pre-Build-Event by removing the comments ("REM") in the Project properties
      • Hit CTRL-Shift-B (compile)   
  2. Connect to your SharePoint Site
    • Start LinqPad
    • Click  "Add connection"
    • Select "use a typed data context from your own assembly"
    • Select "Static SharePoint 2010 Driver
    • Click Next
    • Browse to the context assembly i.e. the one you generated with the demo project
    • Select a data context type from the list (any derived type of Microsoft.SharePoint.Linq.DataContext will be listed here)
    • Enter the Url of the SharePoint Site containing the entities


Start Linq'in around

  • Work with the entities
  • Check the resulting Caml-Query
  • Check the resulting Lambda-Expression



Last edited May 20, 2011 at 3:54 PM by theiwaz, version 14


knarunkumar Feb 11, 2013 at 11:26 AM 
im not able to querying details form list,(i.e ) if the list contains lookup field the query returns error