• 创建文档库时指定文件夹(路径)


    //templateList是作为模板的列表或文档库

    SPList EnsureArchiveList( SPList templateList)
            {
                SPWeb web = templateList.ParentWeb;
                SPList list = templateList;

                SPList archiveList = null;

                string archiveListTitle = list.Title + "(Archive)";

                try
                {
                    archiveList = web.Lists[archiveListTitle];
                }
                catch { }

                if (archiveList == null)
                {
                    web.AllowUnsafeUpdates = true;

                    string url = "Archive/" + list.RootFolder.Url;
                
                    Guid listId = web.Lists.Add(list.Title + "(Archive)", "List for archive.",  url , list.TemplateFeatureId.ToString(), (int)list.BaseTemplate, "");

                    archiveList = web.Lists[listId];

                    foreach (SPField f in list.Fields)
                    {
                        if (archiveList.Fields.ContainsField(f.InternalName) == false)
                        {
                            archiveList.Fields.Add(f);
                        }
                    }
                }

                return archiveList;       
            }

  • 相关阅读:
    URL Rewrite
    Visual Studio调试Asp程序
    IE6下雪碧图多次请求fix方法
    使用antixss防御xss
    字典及其增删改查,解构用法
    逻辑运算,编码问题
    字符串数据类型及其用法
    数据类型,if 语句,while语句
    列表和字典循环遍历时的删除问题,集合
    列表,及其增删改查,元组
  • 原文地址:https://www.cnblogs.com/jianyi0115/p/1500166.html
Copyright © 2020-2023  润新知