using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
namespace linqtest
{
public class SPLINQ : System.Web.UI.WebControls.WebParts.WebPart
{
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
base.Render(writer);
SPList taskList = SPContext.Current.Web.Lists["Tasks"];
// Get items, order by title alphabetically and assign to taskListItems
var taskListItems = from SPListItem tItem in taskList.Items
orderby tItem.Title
ascending select tItem;
foreach (SPListItem taskItem in taskListItems)
writer.WriteLine(taskItem.Title + "
\n");
}
}
}
Tuesday, September 8, 2009
Subscribe to:
Posts (Atom)