Delete SharePoint Lists Programmatically
using (SPSite osite = new SPSite("SiteURL"))
{
using (SPWeb oweb = osite.OpenWeb())
{
SPListCollection olistcoll = oweb.Lists;
Hashtable ht = new Hashtable();
foreach(SPList olist in olistcoll)
{
if (olist.Title.StartsWith("Test"))
{
ht.Add(olist.ID, olist.Title);
}
}
foreach (Guid ID in ht.Keys)
olistcoll.Delete(ID);
}
}
Comments
Post a Comment