Create() public method

Create List
public Create ( string description, ListTemplateType type ) : bool
description string
type ListTemplateType
return bool
コード例 #1
0
ファイル: List.cs プロジェクト: pabloparra/Enmarcha
        /// <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;
            }
        }
コード例 #2
0
 public void CreateList()
 {
     if (!ContextSharePoint.VerifyServer(Site)) Assert.Inconclusive();
     ListSharePoint= new ListSharePoint(Site.RootWeb,Logger,"LISTATEST");
    Assert.IsTrue(ListSharePoint.Create("descripcion", ListTemplateType.Contacts, true));
     Assert.IsTrue(ListSharePoint.Delete());
 }
コード例 #3
0
 public void CreateListAddContentType()
 {
     if (!ContextSharePoint.VerifyServer(Site)) Assert.Inconclusive();
     var contentType= new ContentType(Site.RootWeb,this.Logger,"TESTHELLO","TEST","Elemento");
     contentType.Create(string.Empty);
     ListSharePoint = new ListSharePoint(Site.RootWeb, Logger, "LISTATEST");
     Assert.IsTrue(ListSharePoint.Create("descripcion", ListTemplateType.Contacts, true));
   Assert.IsTrue(ListSharePoint.AddContentType("TESTHELLO"));
   Assert.IsTrue(ListSharePoint.DeleteContentType("TESTHELLO"));
     Assert.IsFalse(ListSharePoint.AddContentType("TESTBYE"));
     Assert.IsTrue(ListSharePoint.Delete());
 }
コード例 #4
0
 public void CreateListAddField()
 {
     if (!ContextSharePoint.VerifyServer(Site)) Assert.Inconclusive();
     var contentType = new ContentType(Site.RootWeb, this.Logger, "TESTHELLO", "TEST", "Elemento");
     contentType.Create(string.Empty);
     ListSharePoint = new ListSharePoint(Site.RootWeb, Logger, "LISTATEST");
     Assert.IsTrue(ListSharePoint.Create("descripcion", ListTemplateType.Contacts, true));
     var siteColumn = new Entities.Artefacts.SiteColumn(new ParamsSiteColumnBaseExtended
     {
         AddPrefix = false,
         FieldType = SPFieldType.Text,
         Group = "Lista",
         Logger = this.Logger,
         MultiValue = false,
         Name = "Field1",
         Requiered = true,
         Web = Site.RootWeb
     });
    Assert.IsTrue(ListSharePoint.AddField(siteColumn));
     Assert.IsTrue(ListSharePoint.DeleteField(siteColumn));
     Assert.IsTrue(ListSharePoint.Delete());
 }