共用方式為


SPSite.SelfServiceCreateSite method (String, String, String, UInt32, String, String, String, String, String, String, String, String)

Creates a site collection by using Self-Service Site Creation based on the specified quota template and other information.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'宣告
Public Function SelfServiceCreateSite ( _
    siteUrl As String, _
    title As String, _
    description As String, _
    nLCID As UInteger, _
    webTemplate As String, _
    ownerLogin As String, _
    ownerName As String, _
    ownerEmail As String, _
    contactLogin As String, _
    contactName As String, _
    contactEmail As String, _
    quotaTemplate As String _
) As SPSite
'用途
Dim instance As SPSite
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 contactLogin As String
Dim contactName As String
Dim contactEmail As String
Dim quotaTemplate As String
Dim returnValue As SPSite

returnValue = instance.SelfServiceCreateSite(siteUrl, _
    title, description, nLCID, webTemplate, _
    ownerLogin, ownerName, ownerEmail, _
    contactLogin, contactName, contactEmail, _
    quotaTemplate)
public SPSite SelfServiceCreateSite(
    string siteUrl,
    string title,
    string description,
    uint nLCID,
    string webTemplate,
    string ownerLogin,
    string ownerName,
    string ownerEmail,
    string contactLogin,
    string contactName,
    string contactEmail,
    string quotaTemplate
)

參數

  • siteUrl
    Type: System.String

    A string that contains the absolute URL for the site collection.

  • title
    Type: System.String

    A string that contains the title for the site collection.

  • description
    Type: System.String

    A string that contains the description for the site collection.

  • nLCID
    Type: System.UInt32

    An unsigned 32-bit integer that specifies the locale ID.

  • webTemplate
    Type: System.String

    A string that contains the name of the site definition to use to create the site collection.

  • ownerLogin
    Type: System.String

    A string that contains the user name for the site collection owner.

  • ownerName
    Type: System.String

    A string that contains the display name for the site collection owner.

  • ownerEmail
    Type: System.String

    A string that contains the e-mail address for the site collection owner.

  • contactLogin
    Type: System.String

    A string that contains the user name for the secondary contact.

  • contactName
    Type: System.String

    A string that contains the display name for the secondary contact.

  • contactEmail
    Type: System.String

    字串,包含第二位連絡人的電子郵件地址。

  • quotaTemplate
    Type: System.String

    字串,包含配額範本的名稱。

傳回值

Type: Microsoft.SharePoint.SPSite
SPSite 物件,表示新的網站集合。

備註

如果傳遞的strSiteUrl參數的值不會指定絕對 URL, SelfServiceCreateSite方法會擲回例外狀況的型別ArgumentException 。如果在伺服器上停用 [自助網站架設] 時,會呼叫這個方法,會擲回例外狀況的型別SPException

Examples

下列程式碼範例會使用SelfServiceCreateSite方法來建立STS網站範本為基礎的新網站集合。

Using oSiteCollection As New SPSite("http://" + System.Environment.MachineName)
    Dim oSiteCollectionSelfServ As SPSite = oSiteCollection.SelfServiceCreateSite("Absolute_URL", "Title", "Description", Locale_ID, "STS", "Owner_User_Name", "Owner_Display_Name", "Owner_E-mail", "Contact_User_Name", "Contact_Display_Name", "Contact_E-mail")

    oSiteCollectionSelfServ.Dispose()
End Using
using(SPSite oSiteCollection = new SPSite("http://" + System.Environment.MachineName))
{
    SPSite oSiteCollectionSelfServ = oSiteCollection.SelfServiceCreateSite("Absolute_URL", "Title",
    "Description", Locale_ID, "STS", "Owner_User_Name",
    "Owner_Display_Name",  "Owner_E-mail",
    "Contact_User_Name", "Contact_Display_Name", "Contact_E-mail");

    oSiteCollectionSelfServ.Dispose();
}
注意事項注意事項

某些物件實作IDisposable介面,並且您必須避免之後不再需要保留這些物件在記憶體中。良好的程式碼撰寫方式的相關資訊,請參閱Disposing Objects

請參閱

參照

SPSite class

SPSite members

SelfServiceCreateSite overload

Microsoft.SharePoint namespace