2

Is there any way to create a site collection remotely in an on-premises environment where self-service site collection creation is enabled?

There should be no custom web services or logic installed in SharePoint.

4

There is an admin web service for 2010 and 2013: http://msdn.microsoft.com/en-us/library/websvcadmin.admin.createsite%28v=office.14%29.aspx

http://Site/_vti_adm/Admin.asmx
4
  • Could it be possible to create a site collection without being a Farm Administrator? (edited question)
    – thomius
    Dec 5 '13 at 7:10
  • From this MSDN Client Object Model article: msdn.microsoft.com/en-us/library/office/…, "The new client APIs do not provide administration objects or objects that are scoped higher than site collection: SPSite class in the server object model." This seems to indicate that the server object model way you would create a site collection does not have an equivalent for the client object model. I'm not sure of a way to let unprivileged users create site collections without self-service enabled, or elevating privileges, and neither of those is remote...
    – Sean
    Dec 5 '13 at 17:06
  • I was thinking of remotely filling and sending the self-service site collection creation form (using .NET WebClient.UploadValues etc), but this of course would be kind of a hack and would be great if there was another better way..
    – thomius
    Dec 6 '13 at 11:23
  • I edited the question back to original and marked this as answer as you answered correctly to the exact question (which did not rule out Farm Administrators). Creating a new question for less privileges :)
    – thomius
    Dec 6 '13 at 11:40
2

Thanks to @Sean pointing out the web service, I was able to implement a solution using PowerShell.

The inputs to the script are as follows:

  • $user - farm admin login (I am also using this as the owner of the new site collection)
  • $pwd - farm admin pwd
  • $adminSiteUrl - central admin site URL (must be accessible from the box where this script is running)
  • $siteUrl - the full URL of the new site collection to be created
  • $siteTitle - the title of the new site collection
  • $username - the display name of the new site collection owner

Here's the script:

$securePwd = ConvertTo-SecureString $pwd -AsPlainText -Force
$cred = New-Object PSCredential($user, $securePwd)
$wsdlUrl = $adminSiteUrl + "/_vti_adm/Admin.asmx?WSDL"
$svc = New-WebServiceProxy -Uri $wsdlUrl -Credential $cred
$svc.Timeout = 300000    # 5 minute timeout
$svc.CreateSite(
    $siteUrl,   # URL
    $siteTitle, # Title
    "",         # Description
    1033,       # LCID
    "STS#0",    # WebTemplate
    $user,      # Owner Login
    $userName,  # Owner Name
    "",         # Owner Email
    "",         # PortalUrl
    "")         # PortalName

You can call DeleteSite similarly (it's simpler as it has only one parameter). I started out down the route of creating a tenant administration site for my on-prem SP2013 but was having authentication issues and fell back to this approach.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.