我想像这样在共享点中创建多级子站点:
- SiteCollection1
- subsite1
- subsite1A
- subsite1AA
- subsite1AAA
如何在Powershell中使用wci来实现它?目前,我只能在同一级别创建多个子站点,如下所示:
#create web using WebCreationInformatin object (wci)
for($i=1;$i -le $subsiteCount;$i++)
{
$webURL = "MySubSite$i"
$title = "My SubSite$i"
$wci = New-Object Microsoft.SharePoint.Client.WebCreationInformation
$wci.url = $webURL
$wci.title = $title
$wci.webtemplate = $template
$wci.useSamePermissionsAsParentSite = $useSamePermissionsAsParentSite
$createWeb = $context.web.webs.add($wci)
$context.load($createWeb)
#send the request containing all operations to the server
try{
$context.executeQuery()
write-host "info: Creating $($title)" -foregroundcolor green
}
catch{
write-host "info: $($_.Exception.Message)" -foregroundcolor red
}
}
我想添加一个新参数“ $ subsiteLevel”以指定将创建子站点的深度。