PowerShell - How to create a subsite in Sharepoint Online

4

I have a website and I need to create sub-sites dynamically because they are many clients and I tried using powershell for this, but I can only create a site collection. Example:

new-SPOSite -url httl://url.sharepoint.com/douglas -owner [email protected]

This makes my site all right, but I need to create sub-sites, for example:

httl://url.sharepoint.com/douglas/cliente1
httl://url.sharepoint.com/douglas/cliente2
httl://url.sharepoint.com/douglas/cliente3
httl://url.sharepoint.com/douglas/cliente4

That way it does not work and I can not find an explanation or a way to do this. Manually creating is out of the question as there are many clients and more and more requests come in.

I have not found a solution yet on google. Can someone help?

Thank you.

    
asked by anonymous 03.06.2014 / 20:00

3 answers

2

Can not: link

  

Managing sub sites with PowerShell is not available in SharePoint Online, and the current PowerShell cmdlets are almost for site collections

    
20.07.2014 / 22:34
1

Two things:

  • If you can let your customers create websites, it might make things easier for you. Just the staff have the Manage Hierarchy permission on the site collection. Hence in the root site settings they can create the children (in Site Administration -> Sites and Workspaces ).

Editing: After seeing Sunstreaker's response, I noticed that you are using a command to create a site collection. To create subsites the correct command is New-SPWeb .

  • If your goal is for sites to be created without staff having any access to the root of the collection, you can create a script that accepts parameters.

Create a .ps1 extension file with something like:

$endereco = $args[0]
$titulo = $args[1]

new-SPWeb -url $endereco -name $titulo

Then you call it from the prompt, being in the folder where the file is (assuming the file is called foo.ps1 ):

powershell.exe foo.ps1 "httl://url.sharepoint.com/douglas/clienteBar" "Site do Bar"

Or you can make a .NET program in two minutes while generating and executing these calls;

    
03.06.2014 / 20:10
0

It ended up by powershell myself I could not and switched to script where I can create as many as I need each subsite. Thanks for the answers.

    
11.09.2014 / 19:09