SPSiteCollection.Add Method (SPSiteSubscription, String, String, String, UInt32, String, String, String, String, String, String, String, Boolean)
Creates an SPSite object in the collection based on the specified site subscription, URL, title, description, locale identifier (LCID), and site definition or site template, as well as on the user names, user display names, and e-mail addresses of both the collection owner and a secondary contact.
Namespace: Microsoft.SharePoint.Administration
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
Syntax
'Declaration
Public Function Add ( _
siteSubscription As SPSiteSubscription, _
siteUrl As String, _
title As String, _
description As String, _
nLCID As UInteger, _
webTemplate As String, _
ownerLogin As String, _
ownerName As String, _
ownerEmail As String, _
secondaryContactLogin As String, _
secondaryContactName As String, _
secondaryContactEmail As String, _
useHostHeaderAsSiteName As Boolean _
) As SPSite
'Usage
Dim instance As SPSiteCollection
Dim siteSubscription As SPSiteSubscription
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 secondaryContactLogin As String
Dim secondaryContactName As String
Dim secondaryContactEmail As String
Dim useHostHeaderAsSiteName As Boolean
Dim returnValue As SPSite
returnValue = instance.Add(siteSubscription, _
siteUrl, title, description, nLCID, _
webTemplate, ownerLogin, ownerName, _
ownerEmail, secondaryContactLogin, _
secondaryContactName, secondaryContactEmail, _
useHostHeaderAsSiteName)
public SPSite Add(
SPSiteSubscription siteSubscription,
string siteUrl,
string title,
string description,
uint nLCID,
string webTemplate,
string ownerLogin,
string ownerName,
string ownerEmail,
string secondaryContactLogin,
string secondaryContactName,
string secondaryContactEmail,
bool useHostHeaderAsSiteName
)
Parameters
siteSubscription
Type: Microsoft.SharePoint.SPSiteSubscriptionA subscription to a collection of SPSite objects.
siteUrl
Type: System.StringA String that contains the URL for the site object, for example, Site_Name or sites/Site_Name. It may either be server-relative or absolute for typical sites. It must be absolute if the useHostHeaderAsSiteName parameter is true.
title
Type: System.StringA String that contains the title for the site object.
description
Type: System.StringA String that contains the description for the site object.
nLCID
Type: System.UInt32An unsigned 32-bit integer that specifies the LCID for the site object.
webTemplate
Type: System.StringA String that specifies the site definition or site template for the site object. Specify a null reference (Nothing in Visual Basic) to create a site without applying a template to it. For a list of default site definitions, see Remarks.
ownerLogin
Type: System.StringA 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 ownerLogin parameter must contain a value, even if the value does not correspond to an actual user name.
ownerName
Type: System.StringA String that contains the display name of the owner of the site object.
ownerEmail
Type: System.StringA String that contains the e-mail address of the owner of the site object.
secondaryContactLogin
Type: System.StringA String that contains the user name of a secondary contact for the site object (for example, Domain \User).
secondaryContactName
Type: System.StringA String that contains the display name of a secondary contact for the site object.
secondaryContactEmail
Type: System.StringA String that contains the e-mail address of a secondary contact for the site object.
useHostHeaderAsSiteName
Type: System.Booleantrue to identify the site collection by the host header; false to identify the site collection by the relative path.
Return Value
Type: Microsoft.SharePoint.SPSite
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 Microsoft SharePoint Foundation.
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 |
Note that WIKI provides a site definition configuration for legacy wiki sites that were originally created in an earlier version of SharePoint Foundation. Because standard site pages on SGS sites are wiki-enabled pages, you do not need to create sites that are specifically for wikis.
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.