“Linq到Sharepoint”;其中;找不到子句

“Linq到Sharepoint”;其中;找不到子句,linq,sharepoint,linq-to-sharepoint,Linq,Sharepoint,Linq To Sharepoint,各位好,飞越者 我第一次尝试使用LINQ to Sharepoint,但我的where关键字未被识别:“找不到源类型“Microsoft.Sharepoint.SPList.”的查询模式的实现。where“未找到” 请求如下: using System.Linq; [...] var query = from item in listToQuery where item.Site == _siteToQuery && i

各位好,飞越者

我第一次尝试使用LINQ to Sharepoint,但我的where关键字未被识别:“找不到源类型“Microsoft.Sharepoint.SPList.”的查询模式的实现。where“未找到”

请求如下:

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和Result是两个SPListItemCollection


为什么哪里不被识别?

这很正常。SharePoint对象未实现Linq查询,因此出现此异常

要查询SharePoint列表,您需要使用CAML查询(具有类型的对象) 您可以在internet上找到许多关于“如何以编程方式查询sharepoint列表”的文档

但如果您仍然希望在Sharepoint上使用LINQ,则可以使用