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)
Visual Basic (Declaration)
Public Function Add ( _
siteUrl As String, _
ownerLogin As String, _
ownerEmail As String _
) As SPSite
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
A string that contains the server-relative URL for the site collection (for example, Site_Name or sites/Site_Name).
- ownerLogin
A 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 strOwnerLogin parameter must contain a value even if the value does not correspond to an actual user name.
- ownerEmail
A string that contains the e-mail address of the owner of the site collection.
Return Value
An SPSite object that represents the new site collection.
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");