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; }
                    }
                });
            }
  • 相关阅读:
    PowerDesigner 取消 Name 和 Code 的同步
    租赁内含利率、增量借款利率
    投资收益月末结转
    产品保修费计入哪里
    投资收益
    投资性房地产成本模式转为公允价值模式
    公允价值变动计入所得税费用还是其他综合收益
    所得税费用
    什么是预算会计
    产品质量保证费纳入应纳税所得额吗
  • 原文地址:https://www.cnblogs.com/qixing_gan/p/2771846.html
Copyright © 2011-2022 走看看