如何使用linq更新sharepoint 2010中的记录

如何使用linq更新sharepoint 2010中的记录,linq,sharepoint-2010,Linq,Sharepoint 2010,我无法使用新的linq功能更新SharePoint 2010中的记录。 下面是我的代码,请检查一下 AbsentTrackingSystemEntitiesDataContext ctx = new AbsentTrackingSystemEntitiesDataContext(spWeb.Url); ctx.ObjectTrackingEnabled = true; HolidaysItem Holidayobj = GetH

我无法使用新的linq功能更新SharePoint 2010中的记录。 下面是我的代码,请检查一下

  AbsentTrackingSystemEntitiesDataContext ctx = new AbsentTrackingSystemEntitiesDataContext(spWeb.Url);
                ctx.ObjectTrackingEnabled = true;
                HolidaysItem Holidayobj = GetHolidays(HolidayID, ctx); // get the specific record to be update.
                if (Holidayobj != null)
                {
                    Holidayobj.Title = "test";
                    Holidayobj.HolidayDate = DateTime.Today;
                    Holidayobj.Description = "test holiday";   
                    ctx.Holidays.Attach(Holidayobj);
                    // or ctx.Holidays.Attach(Holidayobj, true); not working in 2010
                    ctx.SubmitChanges();
                  }

这根本不是必需的。 ctx.Holiday.Attach(Holidayobj)

ctx.SubmitChanges();这就是你所需要的