SPSiteCollection.Add method (String, String, String)
Creates an SPSite object based on the specified URL and on the user name and e-mail address of the owner of the site collection.
Namespace: Microsoft.SharePoint.Administration
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaration
Public Function Add ( _
siteUrl As String, _
ownerLogin As String, _
ownerEmail As String _
) As SPSite
'Usage
Dim instance As SPSiteCollection
Dim siteUrl As String
Dim ownerLogin As String
Dim ownerEmail As String
Dim returnValue As SPSite
returnValue = instance.Add(siteUrl, ownerLogin, _
ownerEmail)
public SPSite Add(
string siteUrl,
string ownerLogin,
string ownerEmail
)
Parameters
siteUrl
Type: System.StringA String that contains the URL for the site collection, for example, Site_Name or sites/Site_Name. It may either be server-relative or absolute for typical sites.
ownerLogin
Type: System.StringA String that contains the user name of the owner of the site collection (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.
ownerEmail
Type: System.StringA String that contains the e-mail address of the owner of the site collection.
Return value
Type: Microsoft.SharePoint.SPSite
An SPSite object that represents the new site collection.
Examples
The following code example creates a site collection within a specified Web application.
Dim webApp As SPWebApplication = New SPSite("http://MySiteCollection").WebApplication
Dim siteCollections As SPSiteCollection = webApp.Sites
Dim newSiteCollection As SPSite = siteCollections.Add("sites/Site_Collection", "DOMAIN\User", "Email_Address")
SPWebApplication webApp = new SPSite("http://MySiteCollection").WebApplication;
SPSiteCollection siteCollections = webApp.Sites;
SPSite newSiteCollection = siteCollections.Add("sites/Site_Collection",
"DOMAIN\\User", "Email_Address");