public void createlist()
{
try
{
using (SPSite osite = new SPSite(SPContext.Current.Web.Site.ID))
{
using (SPWeb oweb = osite.OpenWeb())
{
oweb.AllowUnsafeUpdates = true;
if (oweb.Lists.TryGetList("Training list") == null)
{
oweb.Lists.Add("Training list", " ", SPListTemplateType.GenericList);
}
SPList olist = oweb.Lists.TryGetList("Training list");
olist.OnQuickLaunch = true;
olist.Update();
oweb.AllowUnsafeUpdates = false;
}
}
}
catch (Exception ex)
{
throw ex;
}
}
No comments:
Post a Comment