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)