In this article we will be seeing how to use LINQ in SharePoint 2010 to query
In SharePoint 2010 you have the ability to use LINQ syntax to query the list
instead of using CAML query. In order to work with LINQ we need a command line
tool called SPMetal.exe.
This tool is used to generate the entity classes that is required to perform
object oriented queries towards SharePoint server. It is also required to get
the intellisense when we are working in Visual Studio 2010.This tool resides in
Creating the entity classes:
- Open Command Prompt as an administrator.
- Change the path to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN.
- Run the following command to generate the entity classes.
Spmetal.exe /web:http://servername:2010/sites/test/ /code:C:\MyEntities.cs
Querying SharePoint list using LINQ: