如何使用LINQ查询更新列表视图(sharepoint 2007)

时间:2011-01-19 08:30:56

标签: linq sharepoint-2007

如何使用LINQ查询更新列表视图(sharepoint 2007):

SPList taskList = SPContext.Current.Web.Lists["List1"];
SPList branchList = SPContext.Current.Web.Lists["List2"];

var taskListItems = from SPListItem tItem in taskList.Items
                    join SPListItem IItem in branchList.Items on tItem["Branch"].ToString().Split(new string[]{";#"},StringSplitOptions.None)[1] equals IItem.Title.ToString()
                    where IItem.Title.ToString() == "Kazan"
                    select tItem.Title;

1 个答案:

答案 0 :(得分:0)

SharePoint 2007不支持Linq(.net 3.5)开箱即用,我猜您使用的是模板吗?

您需要按照指南进行设置:

http://www.zimmergren.net/archive/2008/09/22/how-to-get-up-and-running-with-net-3-5-in-your-sharepoint-environment.aspx

然后,本指南可能会帮助您构建查询

http://www.zimmergren.net/archive/2008/09/24/how-to-use-linq-and-the-net-3-5-framework-with-sharepoint-to-retreive-sharepoint-list-items.aspx