Sharepoint 코드는 사이트 사이트 템플릿 SPWebCollection을 만듭니다.Add()

5991 단어 Collection
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; }

                }

            });

        }

좋은 웹페이지 즐겨찾기