Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
SDK Documentation
Add Method
 Add Method (String, String, String)

  Switch on low bandwidth view
Community Content
In this section
Statistics Annotations (0)
SPSiteCollection.Add Method (String, String, String) (Microsoft.SharePoint.Administration)
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
Visual Basic (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)
C#
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.

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_Collection", "DOMAIN\User", "Email_Address")
C#
SPWebApplication webApp = new SPSite("http://MySiteCollection").WebApplication;
SPSiteCollection siteCollections = webApp.Sites;

SPSite newSiteCollection = siteCollections.Add("sites/Site_Collection", 
    "DOMAIN\\User", "Email_Address");
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker