using
(SPWeb web = SPContext.Current.Site.OpenWeb("/"))
{
SPList list = web.GetList("/subsite/Lists/list1");
Context.Response.Write("Total items: " + list.ItemCount + "");
Context.Response.Write("Deleting Items....");
web.AllowUnsafeUpdates =true;
foreach (SPListItem item in list.Items)
{
item.Delete();
list.update();
}
web.AllowUnsafeUpdates =false;
}
No comments:
Post a Comment