Enmarcha.SharePoint.Entities.Artefacts.ListSharePoint.Create C# (CSharp) Method

Create() public method

Create List
public Create ( string description, ListTemplateType type ) : bool
description string
type ListTemplateType
return bool
        public bool Create(string description, ListTemplateType type)
        {
            return Create(description,  type, false);
        }

Same methods

ListSharePoint::Create ( string description, ListTemplateType type, bool versionControl ) : bool

Usage Example

Example #1
0
        /// <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;
            }
        }
All Usage Examples Of Enmarcha.SharePoint.Entities.Artefacts.ListSharePoint::Create