SPSiteCollection.Add Method (String, String, String, UInt32, String, String, String, String) (Microsoft.SharePoint.Administration)
Creates an SPSite object in the collection based on the specified URL, title, description, locale identifier (LCID), and site definition or site template, as well as on the user name, user display name, and e-mail address of the owner of the site collection.

Namespace: Microsoft.SharePoint.Administration
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Syntax

Visual Basic (Declaration)
Public Function Add ( _
    siteUrl As String, _
    title As String, _
    description As String, _
    nLCID As UInteger, _
    webTemplate As String, _
    ownerLogin As String, _
    ownerName As String, _
    ownerEmail As String _
) As SPSite
Visual Basic (Usage)
Dim instance As SPSiteCollection
Dim siteUrl As String
Dim title As String
Dim description As String
Dim nLCID As UInteger
Dim webTemplate As String
Dim ownerLogin As String
Dim ownerName As String
Dim ownerEmail As String
Dim returnValue As SPSite

returnValue = instance.Add(siteUrl, title, description, nLCID, webTemplate, ownerLogin, ownerName, ownerEmail)
C#
public SPSite Add (
    string siteUrl,
    string title,
    string description,
    uint nLCID,
    string webTemplate,
    string ownerLogin,
    string ownerName,
    string ownerEmail
)

Parameters

siteUrl

A string that contains the server-relative URL for the site object (for example, Site_Name or sites/Site_Name).

title

A string that contains the e-mail address of the owner of the site object.

description

A string that contains the description for the site object.

nLCID

An unsigned 32-bit integer that specifies the LCID for the site object.

webTemplate

A string that specifies the site definition or site template for the site object. Specify null to create a site without applying a template to it. For a list of default site definitions, see Remarks.

ownerLogin

A string that contains the user name of the owner of the site object (for example, Domain\User). In Active Directory Domain Services account creation mode, the strOwnerLogin parameter must contain a value even if the value does not correspond to an actual user name.

ownerName

A string that contains the display name of the owner of the site object.

ownerEmail

A string that contains the e-mail address of the owner of the site object.

Return Value

An SPSite object that represents the new site collection.
Remarks

The following table shows the values for the default site definitions that are included in an installation of Windows SharePoint Services.

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

WIKI#0

Wiki

BLOG#0

Blog

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.

Example

The following code example creates a site collection within a specified Web application.

Visual Basic
Dim webApp As SPWebApplication = New SPSite("http://MySiteCollection").WebApplication
Dim siteCollections As SPSiteCollection = webApp.Sites

Dim newSiteCollection As SPSite = siteCollections.Add("sites/Site_Name", "Site_Title", "Site_Description", 1033, "STS#0", "DOMAIN\User", "Owner_User_Name", "Owner_Email")
C#
SPWebApplication webApp = new SPSite("http://MySiteCollection").WebApplication;
SPSiteCollection siteCollections = webApp.Sites;

SPSite newSiteCollection = siteCollections.Add("sites/Site_Name", 
    "Site_Title", "Site_Description", 1033, "STS#0", 
    "DOMAIN\\User", "Owner_User_Name", "Owner_Email");
See Also

Tags :


Community Content

Thomas Lee
The "title" parameter
Description of the "title" parameter is wrong.
Tags : contentbug

Page view tracker