If BDC external data column has been added to a custom list, easiest way to retrieve an item using filter conditions is similar to
using
(MyWebDataContext context = new MyWebDataContext(SPContext.Current.Web.Url))
{
SPList myList = SPContext.Current.Web.Lists["My List Title"];
var myListResult = context.AthleteAppearances.Where(r => r.UniqueColumn == "filter value").FirstOrDefault();
if (myListResult != null && myListResult.Id.HasValue)
{
SPListItem myItem = myList.GetItemByIdAllFields(myListResult.Id.Value);
//Add your code to update the list item here
}
}
using
(MyWebDataContext context = new MyWebDataContext(SPContext.Current.Web.Url))
{
SPList myList = SPContext.Current.Web.Lists["My List Title"];
var myListResult = context.AthleteAppearances.Where(r => r.UniqueColumn == "filter value").FirstOrDefault();
if (myListResult != null && myListResult.Id.HasValue)
{
SPListItem myItem = myList.GetItemByIdAllFields(myListResult.Id.Value);
//Add your code to update the list item here
}
}
No comments:
Post a Comment