2016-06-30 97 views
0

我们正在重构我们的SharePoint环境并拥有子网站,我们将迁移到他们自己的网站集。但是,我们需要保留对象的GUID,因此我们将使用Microsoft.SharePoint.Deployment选项。使用部署API将SharePoint子网站移动到网站集的根目录

我遇到的麻烦是使用它不会允许我将导出的网站导入新网站集的根目录。如果我出口网络,如本

Export-SPWeb "http://sharepoint.domain.com/sites/site1/example" -Path c:\export\example.cmp 

然后用下面的脚本导入它使子站点路径

例如,

$siteURL = "http://sharepoint.domain.com/sites/site2/" 
$fileLocation = "c:\export" 
$fileName = "example.cmp" 

[void][System.Reflection.Assembly]::load("Microsoft.Sharepoint, version=12.0.0.0, culture=neutral, publickeytoken=71e9bce111e9429c") 

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Deployment") 

# settings 

$settings = new-object Microsoft.SharePoint.Deployment.SPImportSettings 
$settings.SiteUrl = $siteURL 
$settings.WebUrl = $siteURL 
$settings.FileLocation = $fileLocation 
$settings.FileCompression = $true 
$settings.RetainObjectIdentity = $true 
$settings.UserInfoDateTime = [Microsoft.SharePoint.Deployment.SPImportUserInfoDateTimeOption]::ImportAll 
$settings.BaseFileName = $fileName 

$import = new-object Microsoft.SharePoint.Deployment.SPImport($settings) 
$import.Run() 

这样做的目的是example.cmp将作为根网络恢复到http://sharepoint.domain.com/sites/site2/,但是这个恢复到http://sharepoint.domain.com/sites/site2/example

有谁知道h ow得到这个恢复到根?我不能使用Import-SPWeb来做到这一点,因为我需要保留GUID。

+0

出于好奇,为什么你需要保留GUID? – Thriggle

+0

主要是为了防止我们需要重新创建与列表关联的工作流程。试图不需要重新创建它们,它们继续使用'SPImport'正常运行。 – Kirk

回答

0

经过对此的深入研究,由于我们试图移动到自己的网站集的网站已启用发布功能,因此无论如何似乎都需要这样做。

https://support.microsoft.com/en-in/kb/968483

Microsoft Office SharePoint服务器2007/2010/2013不支持 迁移子网站为根网站或根网站进入 网站集具有发布功能打开子网站。

我在猜测部署API正在使用这个限制。

作为参考,这是我们需要遵循的解决方案。

有效迁移使用发布功能时的场景是 如下:

  • 导出网站集开始在根网站,然后导入它作为根网站到一个新的站点集合
  • 导出网站集的子网站,然后将它们作为子网站导入到已启用功能的现有网站集中