Create List

1. Create List

ContractedBlock.gif ExpandedBlockStart.gif 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/archive/2011/10/04/2198945.html

你可能感兴趣的:(Create List)