Import-SPWeb

导入 Web、列表或库。

语法

Default (默认值)

Import-SPWeb
    [-Identity] <SPWebPipeBind>
    -Path <String>
    [-ActivateSolutions]
    [-AssignmentCollection <SPAssignmentCollection>]
    [-Confirm]
    [-Force]
    [-HaltOnError]
    [-HaltOnWarning]
    [-IncludeUserCustomAction <SPIncludeUserCustomAction>]
    [-IncludeUserSecurity]
    [-NoFileCompression]
    [-NoLogFile]
    [-UpdateVersions <SPUpdateVersions>]
    [-WhatIf]
    [-PreserveDeletedUserMetadataReferences]
    [<CommonParameters>]

说明

Import-SPWeb cmdlet 可导入 Web、列表或库。 从库导入功能是 SharePoint 产品中的一项新功能。

有关适用于 SharePoint 产品的 Windows PowerShell 的权限和最新信息,请参阅 SharePoint Server cmdlet

示例

Import-SPWeb https://site -Path export.cmp -UpdateVersions Overwrite

此示例将 export.cmp 的内容导入到网站 https://site,使用 export.cmp 文件的内容覆盖网站上已进行版本管理的内容。

参数

-ActivateSolutions

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定是否在导入时激活用户解决方案。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-AssignmentCollection

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

管理对象以便正确进行处理。 使用 SPWeb 或 SPSite 等对象可能会耗用大量内存,而且在 Windows PowerShell 脚本中使用这些对象需要正确管理内存。 通过使用 SPAssignment 对象,可以将对象分配给变量,然后在不需要这些对象时对它们进行处理,以释放内存。 在使用 SPWeb、SPSite 或 SPSiteAdministration 对象时,如果不使用分配集合或 Global 参数,则会自动处理这些对象。

在使用 Global 参数时,所有对象均包含在全局存储中。 如果未立即使用对象,或未通过使用 Stop-SPAssignment 命令来处理对象,则可能会发生内存不足的情况。

参数属性

类型:SPAssignmentCollection
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Confirm

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

执行命令前,看到确认提示。 有关详细信息,请键入以下命令:get-help about_commonparameters

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False
别名:cf

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Force

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

此参数在此 cmdlet 中没有函数。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-HaltOnError

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

出现错误时停止导入过程。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-HaltOnWarning

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

出现警告时停止导入过程。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Identity

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定要导入到的 Web 的 URL 或 GUID。

键入的值必须是有效的 URL、GUID 或对象;例如,有效的 URL 形式为 https://server_name,或 GUID 的形式为 1234-4567-5678a。

参数属性

类型:SPWebPipeBind
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:1
必需:True
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False

-IncludeUserCustomAction

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定导入期间是否包括用户自定义操作。

有效值包含:

全部、无

参数属性

类型:SPIncludeUserCustomAction
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-IncludeUserSecurity

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

保留用户安全设置。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-NoFileCompression

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

启用或禁用导入包中的文件压缩。 导入包存储在 Path 参数或 Identity 参数指定的文件夹中。 出于性能方面的考虑,建议您使用此参数。 如果启用压缩,则导入过程的速度可提高大约 30%。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-NoLogFile

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

取消生成导入日志文件。 如果此参数不存在,则 Import-SPWeb cmdlet 将在导出包所在的位置生成一个导出日志文件。 该日志文件使用统一日志记录服务 (ULS)。

建议您使用此参数。 但是,为提高性能,您可能不想生成日志文件。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Path

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定导入文件的名称。

如果使用了 NoFileCompression 参数,则必须指定目录;否则,任何文件格式都有效。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-PreserveDeletedUserMetadataReferences

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

即使 SPUser 对象在目标网站上被标记为已删除,也会尝试为项计算“Author” (“Created By”) 字段。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-UpdateVersions

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指示如何解决要导入到网站的文件在该网站中已存在的情况。 如果不存在 UpdateVersions 参数,则导入作默认使用值 1 (Append) 。

必须为下列类型之一:

-Append,它将新版本添加到当前文件

-覆盖文件及其所有版本 (删除,然后插入)

-如果目标上存在文件,则忽略该文件

默认值为“向当前文件添加新版本”。

有效值包含:

追加、忽略、覆盖

参数属性

类型:SPUpdateVersions
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-WhatIf

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

显示一条描述命令作用的消息,而不执行命令。 有关详细信息,请键入以下命令:get-help about_commonparameters

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False
别名:无线

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

CommonParameters

此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters