如何在SharePoint中创建多级子网站

时间:2020-02-04 15:07:54

标签: sharepoint-online

我想像这样在共享点中创建多级子站点:

- 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”以指定将创建子站点的深度。

0 个答案:

没有答案