public DataTable GetListItems()
{
SPSite spSite = new SPSite("http://larMOSS/properties/Lists/Property%20List/");
SPWeb spWeb = spSite.OpenWeb();
SPList spList = spWeb.Lists["Property List"];
DataTable dt = spList.Items.GetDataTable();
DataTable newdt;
if (dt != null)
{
DataView dv = new DataView(dt);
dv.RowFilter = "Status = 'Active'"; //condition like where clause
string[] st = { "Title", "Owner", "Status" };
newdt = dv.ToTable(False, st);
}
dt = null;
spList = null;
spWeb = null;
spSite = null;
return newdt;
}
No comments:
Post a Comment