Create List

1. Create List

View Code
        public static bool CreateList(SPWeb web,string listName,string strDescription,SPListTemplateType type,bool IsOnQuickLaunch)
{
bool result = false;
try
{
web.AllowUnsafeUpdates = true;
Guid newListId = web.Lists.Add(listName, strDescription, type);
SPList newList = web.Lists[newListId];
newList.OnQuickLaunch = IsOnQuickLaunch;
newList.Update();
result = true;
return result;
}
catch (Exception ex)
{
return result;
}
}


方法引用:CreateList(SPContext.Current.Web,"test","",SPListTemplateType.GenericList,true)

原文地址:https://www.cnblogs.com/gzh4455/p/2198945.html