Import-SPWeb

 

適用版本: SharePoint Foundation 2010, SharePoint Server 2010

上次修改主題的時間: 2015-03-09

匯入網站集合、Web 應用程式、清單或文件庫。

Syntax

Import-SPWeb [-Identity] <SPWebPipeBind> -Path <String> [-ActivateSolutions <SwitchParameter>] [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-HaltOnError <SwitchParameter>] [-HaltOnWarning <SwitchParameter>] [-IncludeUserCustomAction <None | All>] [-IncludeUserSecurity <SwitchParameter>] [-NoFileCompression <SwitchParameter>] [-NoLogFile <SwitchParameter>] [-UpdateVersions <Append | Overwrite | Ignore>] [-WhatIf [<SwitchParameter>]]

詳細說明

Import-SPWeb Cmdlet 會匯入網站集合、Web 應用程式、清單或文件庫。能夠從文件庫中匯入是 SharePoint 2010 產品的新功能。

如需 Windows PowerShell for SharePoint 產品的權限及最新資訊,請參閱線上文件 (https://go.microsoft.com/fwlink/?LinkId=163185)。

Parameters

參數 必要 類型 描述

Identity

必要

Microsoft.SharePoint.PowerShell.SPWebPipeBind

指定匯入目的地的 URL 或 GUID。

此類型必須是有效的 URL、GUID 或物件,例如格式為 http://server_name 的有效 URL,或格式為 1234-4567-5678a 的 GUID。

Path

必要

System.String

指定匯入檔案的名稱。

若使用 NoFileCompression 參數,即必須指定目錄,否則所有檔案格式皆屬有效。

ActivateSolutions

選用

System.Management.Automation.SwitchParameter

指定匯入期間是否要啟動使用者解決方案。

AssignmentCollection

選用

Microsoft.SharePoint.PowerShell.SPAssignmentCollection

為能適當處置物件而管理物件。使用 SPWebSPSite 等物件可能會耗用大量的記憶體,因此在 Windows PowerShell 指令碼中使用這些物件時,必須適當地管理記憶體。您可以使用 SPAssignment 物件將物件指派給變數,並在不需要時處置這些物件,以釋放記憶體。使用 SPWebSPSiteSPSiteAdministration 物件時,若未使用指派集合或 Global 參數,將會自動處置這些物件。

注意

使用 Global 參數時,所有物件會包含在全域儲存區內。若未立即使用物件,或未使用 Stop-SPAssignment 命令處置物件,將會發生記憶體不足的狀況。

Confirm

選用

System.Management.Automation.SwitchParameter

執行命令之前,會先提示您進行確認。如需詳細資訊,請輸入下列命令:get-help about_commonparameters

Force

選用

System.Management.Automation.SwitchParameter

強制覆寫既存的匯出封裝。

此類型必須是下列兩值的其中之一:

-True

-False

預設值為 False

HaltOnError

選用

System.Management.Automation.SwitchParameter

發生錯誤時停止匯入程序。

HaltOnWarning

選用

System.Management.Automation.SwitchParameter

發生警告時停止匯入程序。

IncludeUserCustomAction

選用

Microsoft.SharePoint.Deployment.SPIncludeUserCustomAction

指定匯入期間是否要包括使用者自訂動作。

IncludeUserSecurity

選用

System.Management.Automation.SwitchParameter

保留使用者的安全性設定。

NoFileCompression

選用

System.Management.Automation.SwitchParameter

啟用或停用匯入封裝中的檔案壓縮。匯入封裝會儲存在 Path 參數或 Identity 參數所指定的資料夾內。基於效能的考量,建議使用此參數。若啟用壓縮功能,匯入程序的速度約可加快 30%。

NoLogFile

選用

System.Management.Automation.SwitchParameter

不產生匯入記錄檔。若無此參數,Import-SPWeb Cmdlet 會產生匯出記錄檔,與匯出封裝位於相同的位置。此記錄檔使用統一登入服務 (ULS)。

建議您使用此參數。但是,基於效能考量,您可能不想產生記錄檔。

UpdateVersions

不可以

Microsoft.SharePoint.Deployment.SPUpdateVersions

指出當匯入檔案的網站已存在檔案時,該如何解決這些情況。若無 UpdateVersions 參數,匯入作業預設使用值 1

此類型必須是下列任一項:

-將新版本新增到目前的檔案

-覆寫檔案與檔案的所有版本 (刪除再插入)

-略過目的地中存在的檔案

預設值為將新版本新增到目前的檔案。

WhatIf

選用

System.Management.Automation.SwitchParameter

顯示訊息描述命令效果,而非描述命令執行的效果。如需詳細資訊,請輸入下列命令:get-help about_commonparameters

輸入類型

傳回類型

Example

---------------------範例----------------------

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

此範例會將 export.cmp 內容匯入位於 http://site 的網站,以 export.cmp 檔案中的內容覆寫網站上的版本內容。

See Also

Reference

Export-SPWeb
Get-SPWeb
New-SPWeb
Remove-SPWeb
Set-SPWeb