Import-SPPItem

Top  Previous  Next

Imports list items, documents and folders from a ZIP file to SharePoint. The ZIP file can either be a file that was previously exported using the CopyMove export function or it can be any ZIP file containing files and folders. Version history and author information can only be preserved with ZIP files exported by CopyMove.

Syntax

Import-SPPItem [-Source] <string> [-Target] <SPObjectPipeBind> [-ContentTypeMappings <string[]>] [-DisableTransactionLimits <SwitchParameter>] [-ExcludeProperties <string[]>] [-FileExistAction <string>] [-IgnoreWarnings <SwitchParameter>] [-IncludePermissions <SwitchParameter>] [-IncludeTimeStamps <SwitchParameter>] [-IncludeUsers <SwitchParameter>] [-IncludeVersions <SwitchParameter>] [-Item <string[]>] [-PropertyMappings <string[]>] [<CommonParameters>]

Parameters

Parameter

Required

Type

Description

Source

Yes

String

The file path of the source ZIP file.

Target

Yes

SPObjectPipeBind

SharePoint destination location. Possible values:

SPFolder object to import to.
String object with the absolute URL address of the SharePoint list folder to import to.

Item

No

String Array

Array of source items to include from the ZIP. The items can be specified by their URL, integer id or Guid. The URLs can be folder relative, site relative or server relative. Omit this parameter to import all items in the ZIP.

ContentTypeMappings

No

String Array

Array of strings with content type mappings in the format; SourceName:TargetName or SourceId:TargetId

List item content types are in turn mapped as specified on all imported items.

PropertyMappings

No

String Array

Array of strings with property mappings in the format; SourceName:TargetName

List item fields and property bag entries are in turn mapped as specified on all imported items.

ExcludeProperties

No

String Array

Array of strings with the internal names of metadata properties and fields to exclude in the import.

FileExistAction

No

String

Action on existing files in the destination. Possible values:

AddAsNewVersion: Add the imported document as a new version. Requires versioning to be enabled in the destination list.
Overwrite: Replace any existing documents. Use the IgnoreWarnings switch to continue importing on file overwrite warnings.
Rename: Preserve any existing documents and import with a new file name.
Skip: Preserve any existing documents and skip importing documents with the same file names.

Default action is Overwrite.

IgnoreWarnings

No

SwitchParameter

Do not abort the import operation on any validation warnings detected before items are imported.

IncludeTimeStamps

No

SwitchParameter

Preserves the item created time and item last modified time on the imported items.

IncludeUsers

No

SwitchParameter

Preserves the item created by user and item last modified by user on the imported items.

IncludeVersions

No

SwitchParameter

Preserves the complete version history on the imported items. Requires versioning to be enabled in the destination list.

IncludePermissions

No

SwitchParameter

Preserves any item level permissions on the imported items.

DisableTransactionLimits

No

SwitchParameter

Disables the CopyMove transaction limits for the total item count and the total item size in MB that can be imported in one transaction. Use this switch when importing large lists and libraries that exceed the transaction limits configured on the global CopyMove settings page in Central Administration. However, the transaction may as a result take a long time to complete and consume a significant amount of memory.

Examples

Imports all files and folders from the SharedDocuments.zip archive to a SharePoint document library while preserving authoring information and full version history.

Import-SPPItem
 -Source "SharedDocuments.zip"
 -Target "https://teams.mydomain.net/sites/site1/Shared Documents"
 -IncludeTimeStamps
 -IncludeUsers
 -IncludeVersions

Imports selected documents from the SharedDocuments.zip archive to a SharePoint document library while preserving authoring information and full version history.

$items = @("Document.docx", "Presentation.pptx", "Folder/Accounting.xls")
 
Import-SPPItem
 -Source "SharedDocuments.zip"
 -Target "https://teams.mydomain.net/sites/site1/Shared Documents"
 -Item $items
 -IncludeTimeStamps
 -IncludeUsers
 -IncludeVersions