zoukankan      html  css  js  c++  java
  • sharepoint 2010 使用自定义列表模版创建列表(2)

    前面用的方法是通过界面上操作,根据自定义模版,创建的列表。sharepoint 2010 使用自定义列表模版创建列表(1)

    这里顺便记录多另一种方法,通过程序来创建。

    ----------------------------------------------------------------------------------------------------------------------------------

    private void CreateListByCustomTemplate()

            {

                SPSite site = new SPSite("http://Win2012Moss");

                SPWeb web = site.OpenWeb();

                //指定要创建的自定义模板

                string TemplateName = "CommunityTemplate.stp";

                SPListTemplate CustomTemplate = null;

                SPListTemplateCollection ListTemplateCollection = web.Site.GetCustomListTemplates(web);

                foreach (SPListTemplate template in ListTemplateCollection)

                {

                    if (template.InternalName == TemplateName)

                    {

                        CustomTemplate = template;

                        break;

                    }

                }

                web.AllowUnsafeUpdates = true;

                string ListName = "ListName";

                Guid guidDiscussionBoard = web.Lists.Add(ListName, "", CustomTemplate);

                web.Update();

                web.Dispose();

            }

    ------------------------------------------------------------------------------------------------------------------------------

  • 相关阅读:
    selenium 安装
    创建项目/执行
    mysql远程访问
    如何通过批处理文件直接运行python代码
    python中通过字典实现函数指针
    装饰器
    正则表达式学习笔记
    Jupyter使用
    【数学】一张通往数学世界的地图-阅读笔记
    【算法导论】二叉搜索树的删除除操作
  • 原文地址:https://www.cnblogs.com/keanuyaoo/p/3285462.html
Copyright © 2011-2022 走看看