/// <summary>
/// Create List
/// </summary>
/// <param name="web"></param>
/// <param name="title"></param>
/// <param name="description"></param>
/// <param name="typeList"></param>
/// <param name="versionControl"></param>
/// <param name="genericClass"></param>
/// <returns></returns>
public static bool CreateList(this SPWeb web, string title, string description, TypeList typeList,
bool versionControl, Type genericClass)
{
try
{
var list = new ListSharePoint(web, Logger, title);
ListTemplateType type;
switch (typeList)
{
case TypeList.DocumentLibrary:
type = ListTemplateType.DocumentLibrary;
break;
case TypeList.PictureLibrary:
type = ListTemplateType.PictureLibrary;
break;
case TypeList.CalendarList:
type = ListTemplateType.Events;
break;
default:
type = ListTemplateType.GenericList;
break;
}
var result = list.Create(description, type, versionControl);
if (genericClass != null) AddFieldInList(list, genericClass);
return result;
}
catch (Exception exception)
{
Logger.Error(string.Concat("Error Create List:", exception.Message));
return false;
}
}