Thursday, January 30, 2014

Using Linq to query Data in SharePoint 2010

Here I am using Linq in SharePoint 2010 to Query SPList data.

Step-1: Use SPMetal.exe to generate DataContext Class for SharePoint

After executing above command your DataContext Class will be generated as shown below...

Step-2: Now Create New Project in Visual Studio -> Create Console Application -> In the Solution Explorer Right click and Add Existing Item ->  Add generated class into your project

Step-3: Add Name Space in your .cs file (I used using testLnq; as given above) and use your DataContext class to query SPList data...


Happy Coding.


No comments:

Post a Comment

SharePoint Deployment Error : The specified path, file name, or both are too long.

Hi, Sometimes we get surprised with below error while deploying wsp file... Solution : To overcome with this issue, we just ne...