LINQ to SharePoint: now available from Microsoft!

  • Post author:
  • Post category:Blog
  • Post comments:0 Comments
  • Reading time:1 mins read

I’ve waiting for “LINQ to SharePoint” feature from Microsoft a long time. Now, with SharePoint SP2 and VS 2008, We’ll easy to use LINQ feature to query SharePoint data.

Before, I tried to use “LINQ for SharePoint” from CodePlex, but I didn’t happy. I think the support from Microsoft for LINQ to SharePoint is the best.

Thanks for the improvement. I’m waiting for some improve features in next version of SharePoint, maybe SharePoint 2010.

Here are my code using LINQ with SharePoint data

SPSite site = new SPSite("http://basquang:8001");
SPWeb web = site.RootWeb;
var listItems = from SPListItem item in web.Lists["Tasks"].Items
                where DateTime.Parse(item["Due Date"].ToString()) <= DateTime.Today
                select item;
foreach (var item in listItems)
{
    Console.WriteLine(item.Title);
}

Leave a Reply