Import-Item

Imports (deserializes) the specified path from the filesystem on the server as a Sitecore item.

Syntax

Import-Item [-Database <Database>] [-Root <String>] [-UseNewId] [-DisableEvents] [-ForceUpdate]

Import-Item [-Item] <Item> [-Recurse] [-Root <String>] [-UseNewId] [-DisableEvents] [-ForceUpdate]

Import-Item [-Preset] <IncludeEntry> [-Root <String>] [-UseNewId] [-DisableEvents] [-ForceUpdate]

Import-Item [-Path] <String> [-Recurse] [-Root <String>] [-UseNewId] [-DisableEvents] [-ForceUpdate]

Detailed Description

The Import-Item command deserializes the specified items.

The simplest syntax requires 2 parameters:

  • -Path : which is a path to the item on the drive but without .item extension. If the item does not exist in the Sitecore tree yet, you need to pass the parent item path.

  • -Root : the directory which is the root of serialization. Trailing slash character is required,

e.g.:

Import-Item -Path "c:\project\data\serialization\master\sitecore\content\articles" -Root "c:\project\data\serialization"

© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions

Aliases

The following abbreviations are aliases for this cmdlet:

  • Deserialize-Item

Parameters

-Database <Database>

Database to contain the item to be deserialized.

Aliases

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

true (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-Item <Item>

The item to be serialized.

Aliases

Required?

true

Position?

1

Default Value

Accept Pipeline Input?

true (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-Preset <IncludeEntry>

Name of the preset to be deserialized.

Aliases

Required?

true

Position?

1

Default Value

Accept Pipeline Input?

true (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-Path <String>

Path to the item on the drive but without .item extension. If the item does not exist in the Sitecore tree yet, you need to pass the parent item path.

Aliases

Required?

true

Position?

1

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Recurse <SwitchParameter>

If included in the execution - dederializes both the item and all of its children.

Aliases

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Root <String>

The directory which is the root of serialization. Trailing slash character is required. if not specified the default root will be used.

Aliases

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-UseNewId <SwitchParameter>

Tells Sitecore if each of the items should be created with a newly generated ID, e.g. Import-Item -path "c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project\data\serialization" -usenewid -recurse

Aliases

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DisableEvents <SwitchParameter>

If set Sitecore will use EventDisabler during deserialization, e.g.: Import-Item -path "c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project

Aliases

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ForceUpdate <SwitchParameter>

Forces item to be updated even if it has not changed.

Aliases

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

Outputs

The output type is the type of the objects that the cmdlet emits.

  • System.Void

Notes

Help Author: Marek Musielak, Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> Import-Item -path "c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project\data\serialization\"

EXAMPLE 2

PS master:\> Import-Item -path "c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project\data\serialization\" -recurse

Last updated