【发布时间】:2016-11-03 00:18:54
【问题描述】:
我们正在重组我们的 SharePoint 环境,并且我们将把子网站迁移到他们自己的网站集。但是,我们需要在执行此操作时保留对象的 GUID,因此我们将使用 Microsoft.SharePoint.Deployment 选项。
我遇到的麻烦是使用它不允许我将导出的网站导入到新网站集的根目录中。它保留子网路径
例如,如果我导出这样的网络
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
有谁知道如何让它恢复到根目录?我不能使用Import-SPWeb 来执行此操作,因为我需要保留 GUID。
【问题讨论】:
-
出于好奇,为什么需要保留 GUID?
-
主要是为了防止我们需要重新创建与列表关联的工作流。试图不需要重新创建它们,它们继续使用
SPImport正常工作。
标签: powershell sharepoint sharepoint-2013