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.

-Item <Item>

The item to be serialized.

-Preset <IncludeEntry>

Name of the preset to be deserialized.

-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.

-Recurse <SwitchParameter>

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

-Root <String>

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

-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

-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

-ForceUpdate <SwitchParameter>

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

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