0

Hello stackoverflowers,

I'm trying to use LINQ to Sharepoint for the first time, but my where keyword isn't recognized : "Could not find an implementation of the query pattern for source type 'Microsoft.SharePoint.SPList'. 'Where' not found".

Here is the request :

using System.Linq;
[...]
  var query = from item in listToQuery
              where item.Site == _siteToQuery
              && item.ReportType == _recordTypeToQuery
              && item.Date == stringDate
              select item;
  Result = listToQuery.GetItems(query);

listToQuery and Result are two SPListItemCollection.

Why is where not recognized ?

Ythio Csi
  • 379
  • 2
  • 14

1 Answers1

0

It's normal. The SharePoint Object doesn't implement Linq query, so that's why you have this exception.

To Query a SharePoint List you need to use a CAML Query (with an object of type SPQuery ) you can find a lot of documentation on internet about "how to query a sharepoint list programmatically"

But if you still want to user LINQ on Sharepoint, you can use SPMetal

Nico
  • 448
  • 4
  • 9