zoukankan      html  css  js  c++  java
  • Sharepoint 代码创建站点 站点模板 SPWebCollection.Add()

      sharepoint中创建站点:

      Method:

    public SPWeb Add(
        string strWebUrl,
        string strTitle,
        string strDescription,
        uint nLCID,
        string strWebTemplate,
        bool useUniquePermissions,
        bool bConvertIfThere
    )

      Parameters:

      strWebUrl
    Type: System.String
    A string that contains the new website URL relative to the root website in the site collection. For example, to create a website at http://MyServer/sites/MySiteCollection/MyNewWebsite, specify MyNewWebsite, or to create a website one level lower at http://MyServer/sites/MySiteCollection/Website/MyNewWebsite, specify Website/MyNewWebsite.
      strTitle
    Type: System.String
    A string that contains the title.
      strDescription
    Type: System.String
    A string that contains the description.
      nLCID
    Type: System.UInt32
    A 32-bit unsigned integer that specifies the locale ID.
      strWebTemplate
    Type: System.String
    A string that contains the name of the site definition configuration or site template.
    By default, a global site template (GLOBAL#0) is added to all site definitions. You cannot explicitly create a site based on a global site template.
      useUniquePermissions
    Type: System.Boolean
    true to create a subsite that does not inherit permissions from another site; otherwise, false .
      bConvertIfThere
    Type: System.Boolean
    true to convert an existing folder of the same name to a SharePoint site. false to throw an exception that indicates that a URL path with the specified site name already exists.

       Site difinition:

    value Site Definition
    STS#0 Team Site
    STS#1 Blank Site
    STS#2 Document Workspace
    MPS#0 Basic Meeting Workspace
    MPS#1 Blank Meeting Workspace
    MPS#2 Decision Meeting Workspace
    MPS#3 Social Meeting Workspace
    MPS#4 Multipage Meeting Workspace
    BLOG#0 Blog
    SGS#0 Basic Group Work Site
    SGS#1 Blank Group Work Site
    WIKI#0 Wiki

      Example:

            /// <summary>
            /// 在当前网站集中创建子网站
             /// </summary>
            /// <param name="strName">子网站的名称</param>
            /// <param name="strWebUrl">子网站的url,如“/subSite”,创建完成后的链接就是http://siteName/subSite</param>
            /// <param name="strType">网站类型,如"Team Site , Blank Site , Wiki Site , Blog"等</param>
            /// <param name="strDescription">网站描述</param>
            private void CreateWeb(string strName, string strWebUrl, string strType, string strDescription)
            {
                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    using (SPSite site = SPContext.Current.Site)
                    {
                        try
                        {
                            site.AllWebs.Add(strWebUrl, strName, strDescription, 1033, strType, false, false);
                        }
                        catch (Exception ex){ throw ex; }
                    }
                });
            }
  • 相关阅读:
    phpmyadmin设置密码,不用登录直接进入
    如何将本地文件复制到远程服务器听语音
    win7 64位wamp2.5无法启动MSVCR110.DLL丢失听语音
    最大连接数:60 iops:150 什么概念?
    北京可以备案什么域名
    远程桌面命令是什么 如何使用命令连接远程桌面
    如何知道电脑是几核?
    nohup命令与&区别,jobs,fg,bg,Ctrl-Z、Ctrl-C、Ctrl-D
    Shell 文件包含
    Shell 输入/输出重定向
  • 原文地址:https://www.cnblogs.com/qixing_gan/p/2771846.html
Copyright © 2011-2022 走看看