zoukankan      html  css  js  c++  java
  • 【Sharepoint对象模型】MOSS中根据列表模板添加列表

    其实只是用到了添加时的一个方法,类似的,可以根据模板添加网站等。
    用于新建项目时单个项目构建网站。
     
     1                  //添加列表
     2                             //Guid newListId = web.Lists.Add("任务列表", "", SPListTemplateType.Announcements);
     3                             ////设置列表显示在快速启动栏
     4                             //SPList newList = web.Lists[newListId];
     5                             //newList.OnQuickLaunch = true;
     6                             //newList.Update();
     7                             //web.Dispose();
     8  
     9                             string TemplateName = "thistask.stp" ;//需要根据所建模版名称进行修改
    10                             SPListTemplate CustomTemplate = null ;
    11                             SPListTemplateCollection ListTemplateCollection = web.Site.GetCustomListTemplates(web);
    12                             foreach (SPListTemplate template in ListTemplateCollection)
    13                             {
    14                                 if (template.InternalName == TemplateName)
    15                                 {
    16                                     CustomTemplate = template;
    17                                     break;
    18                                 }
    19                             }
    20                             web.AllowUnsafeUpdates = true;
    21                             string ListName = ProjectName.Text;
    22                             Guid guidDiscussionBoard = web.Lists.Add(ListName, "", CustomTemplate);
    23                             SPList newList = web.Lists[guidDiscussionBoard];
    24                             newList.OnQuickLaunch = true;
    25                             newList.Update();
    26                             web.Dispose();
  • 相关阅读:
    图论
    后缀数组专题
    AC自动机
    线段树·二
    nginx实现负载均衡
    关于mysql binlog二进制
    linux下每次git clone无需多次输入账号密码
    Centos7 yum安装 MySQL5.7.25
    docker基本操作和部署
    composer update 或者 composer install提示killed解决办法
  • 原文地址:https://www.cnblogs.com/yixiaozi/p/3844098.html
Copyright © 2011-2022 走看看