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)

posted on 2011-10-04 14:56  gzh4455  阅读(263)  评论(0编辑  收藏  举报