• 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; }
                    }
                });
            }
  • 相关阅读:
    小程序开发-Canvas画布组件
    小程序开发-Map地图组件
    小程序开发-媒体组件video使用入门
    小程序开发-媒体组件image
    小程序开发-组件navigator导航篇
    小程序开发-表单组件的使用
    小程序开发-视图容器入门
    小程序开发-基础组件icon/text/progress入门
    小程序开发-block组件的使用
    小程序开发-小程序tabBar不显示的原因分析
  • 原文地址:https://www.cnblogs.com/qixing_gan/p/2771846.html
Copyright © 2020-2023  润新知