Monday, June 18, 2012

sharepoint 2010 get list items linq without SPMetal

Hi All,
There are some situations where we need to get the data form sharepoint list items with a query.

But as we are aware linq is the best way to get the sharepoint list items in fast and efficient way. But to work with sharepoint lists we need to create entity calss with SPMetal.exe

Without using the entity class also we can get the sharepoint list items using System.Linq

Here is the sample code to get the list items from Config list using small filter option.

Here we are trying to get the Config details from Config list.

var item = web.Lists["ConfigList"].Items.OfType().FirstOrDefault(it => it["Key"].ToString() == "ConnectionString");

No comments:

Post a Comment