using (SPSite site = new SPSite(strSiteUrl))
{
using (SPWeb web = site.OpenWeb())
{
SPList spls = web.Lists[strList];
string[] strArrFields = strFields.Split(',');
foreach (string strfield in strArrFields)
{
foreach (SPField spfield in spls.Fields)
{
if (spfield.Title == strfield && spfield.InternalName == "Department_x0020_Manager")
{
spfield.Delete();
break;
}
}
}
}
}
{
using (SPWeb web = site.OpenWeb())
{
SPList spls = web.Lists[strList];
string[] strArrFields = strFields.Split(',');
foreach (string strfield in strArrFields)
{
foreach (SPField spfield in spls.Fields)
{
if (spfield.Title == strfield && spfield.InternalName == "Department_x0020_Manager")
{
spfield.Delete();
break;
}
}
}
}
}
No comments:
Post a Comment