Admin.CreateSite method
Creates a site collection.
Namespace: WebSvcAdmin
Assembly: STSSOAP (in STSSOAP.dll)
Syntax
'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/CreateSite", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/", _
ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function CreateSite ( _
Url As String, _
Title As String, _
Description As String, _
Lcid As Integer, _
WebTemplate As String, _
OwnerLogin As String, _
OwnerName As String, _
OwnerEmail As String, _
PortalUrl As String, _
PortalName As String _
) As String
'Usage
Dim instance As Admin
Dim Url As String
Dim Title As String
Dim Description As String
Dim Lcid As Integer
Dim WebTemplate As String
Dim OwnerLogin As String
Dim OwnerName As String
Dim OwnerEmail As String
Dim PortalUrl As String
Dim PortalName As String
Dim returnValue As String
returnValue = instance.CreateSite(Url, _
Title, Description, Lcid, WebTemplate, _
OwnerLogin, OwnerName, OwnerEmail, _
PortalUrl, PortalName)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/CreateSite", RequestNamespace = "https://schemas.microsoft.com/sharepoint/soap/",
ResponseNamespace = "https://schemas.microsoft.com/sharepoint/soap/",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public string CreateSite(
string Url,
string Title,
string Description,
int Lcid,
string WebTemplate,
string OwnerLogin,
string OwnerName,
string OwnerEmail,
string PortalUrl,
string PortalName
)
Parameters
Url
Type: System.StringString that contains the absolute URL of the site collection.
Title
Type: System.StringString that contains the display name of the site collection.
Description
Type: System.StringString that contains a description for the site collection.
Lcid
Type: System.Int32Integer that specifies the locale identifier (LCID) for the site collection.
WebTemplate
Type: System.StringString that indicates the site template to use for creating the site collection, either 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), or 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.
OwnerLogin
Type: System.StringString that contains the user name (DOMAIN\User_Alias) of the owner.
OwnerName
Type: System.StringString that contains the display name of the owner.
OwnerEmail
Type: System.StringString that contains the e-mail address of the owner.
PortalUrl
Type: System.StringString that contains the URL of a portal site for the site collection.
PortalName
Type: System.StringString that contains the name of a portal site for the site collection.
Return value
Type: System.String
String that contains the URL of the new site collection.
Remarks
The account that accesses this web service must be a member of the Farm Administrators group in the Central Administration site. Note that the server's local Administrators group is in the Farm Administrators group by default.
To access the Admin service and its methods, set a Web reference to https://Server_Name:Port_Number/_vti_adm/Admin.asmx.
Note
This service is only available on the Central Administration Web application, and not in any of the content Web applications.
Examples
The following code example creates a new site collection on the specified server.
Dim admService As New Web_Reference_Folder_Name.Admin()
admService.Credentials = System.Net.CredentialCache.DefaultCredentials
Try
admService.CreateSite("http://Server_Name/sites/SiteCollection_Name", _
"Title", "Description", 1033, "STS#0", _
"Domain_Name\User_Alias", "User_Display_Name", _
"User_E-mail", "", "")
Catch ex As System.Web.Services.Protocols.SoapException
MessageBox.Show("Message:" + ControlChars.Lf + ex.Message +
ControlChars.Lf + _
"Detail:" + ControlChars.Lf + ex.Detail.InnerText +
ControlChars.Lf + _
"StackTrace:" + ControlChars.Lf + ex.StackTrace)
End Try
Web_Reference_Folder_Name.Admin admService =
new Web_Reference_Folder_Name.Admin();
admService.Credentials= System.Net.CredentialCache.DefaultCredentials;
try
{
admService.CreateSite("http://Server_Name/sites/SiteCollection_Name",
"Title", "Description", 1033, "STS#0",
"Domain_Name\\User_Alias","User_Display_Name",
"User_E-mail","","");
}
catch (System.Web.Services.Protocols.SoapException ex)
{
MessageBox.Show("Message:\n" + ex.Message + "\nDetail:\n" +
ex.Detail.InnerText +
"\nStackTrace:\n" + ex.StackTrace);
}