Exemplo n.º 1
0
        public static List CreateList(string title, string description, string url, ListTemplateType templateType, Web web, QuickLaunchOptions quicklaunchOptions)
        {
            ClientContext clientContext = web.Context as ClientContext;

            ListCreationInformation createInfo = new ListCreationInformation();

            createInfo.Title = title;
            createInfo.TemplateType = (int)templateType;

            createInfo.QuickLaunchOption = quicklaunchOptions;

            if (!string.IsNullOrEmpty(description))
            {
                createInfo.Description = description;
            }

            if (!string.IsNullOrEmpty(url))
            {
                createInfo.Url = url;
            }

            // clientContext.Load(web.Lists);

            List newList = web.Lists.Add(createInfo);

            clientContext.ExecuteQuery();

            clientContext.Load(newList);
            clientContext.ExecuteQuery();

            return newList;
        }
Exemplo n.º 2
0
        public static List CreateList(ClientContext ctx, int templateType,
                                       string title, string url, QuickLaunchOptions quickLaunchOptions)
        {
            ListCreationInformation listCreationInfo = new ListCreationInformation
            {
                TemplateType = templateType,
                Title = title,
                Url = url,
                QuickLaunchOption = quickLaunchOptions
            };
            List spList = ctx.Web.Lists.Add(listCreationInfo);
            ctx.Load(spList);
            ctx.ExecuteQuery();

            return spList;
        }
Exemplo n.º 3
0
        public static List CreateList(ClientContext ctx, int templateType,
                                      string title, string url, QuickLaunchOptions quickLaunchOptions)
        {
            ListCreationInformation listCreationInfo = new ListCreationInformation
            {
                TemplateType      = templateType,
                Title             = title,
                Url               = url,
                QuickLaunchOption = quickLaunchOptions
            };
            List spList = ctx.Web.Lists.Add(listCreationInfo);

            ctx.Load(spList);
            ctx.ExecuteQuery();

            return(spList);
        }
Exemplo n.º 4
0
 public QuickLaunchOptionAttribute(bool displayOnQuickLaunch)
 {
     QuickLaunchOption = displayOnQuickLaunch ? QuickLaunchOptions.On : QuickLaunchOptions.Off;
 }
Exemplo n.º 5
0
 public QuickLaunchOptionAttribute(QuickLaunchOptions quickLaunchOption)
 {
     QuickLaunchOption = quickLaunchOption;
 }
Exemplo n.º 6
0
        protected override bool InitOnePropertyFromJson(string peekedName, JsonReader reader)
        {
            bool flag = base.InitOnePropertyFromJson(peekedName, reader);

            if (flag)
            {
                return(flag);
            }
            switch (peekedName)
            {
            case "CustomSchemaXml":
                flag = true;
                reader.ReadName();
                this.m_customSchemaXml = reader.ReadString();
                break;

            case "DataSourceProperties":
                flag = true;
                reader.ReadName();
                this.m_dataSourceProperties = reader.ReadDictionary <string>();
                break;

            case "Description":
                flag = true;
                reader.ReadName();
                this.m_description = reader.ReadString();
                break;

            case "DocumentTemplateType":
                flag = true;
                reader.ReadName();
                this.m_documentTemplateType = reader.ReadInt32();
                break;

            case "QuickLaunchOption":
                flag = true;
                reader.ReadName();
                this.m_quickLaunchOption = reader.ReadEnum <QuickLaunchOptions>();
                break;

            case "TemplateFeatureId":
                flag = true;
                reader.ReadName();
                this.m_templateFeatureId = reader.ReadGuid();
                break;

            case "TemplateType":
                flag = true;
                reader.ReadName();
                this.m_templateType = reader.ReadInt32();
                break;

            case "Title":
                flag = true;
                reader.ReadName();
                this.m_title = reader.ReadString();
                break;

            case "Url":
                flag = true;
                reader.ReadName();
                this.m_url = reader.ReadString();
                break;
            }
            return(flag);
        }