Export-Item

Last updated last month

Exports (serializes) the Sitecore item to the filesystem.

Syntax

Export-Item [-Entry <IncludeEntry>] [-Recurse] [-ItemPathsAbsolute] [-Root <String>]

Export-Item [-Item] <Item> [-Recurse] [-ItemPathsAbsolute] [-Root <String>]

Export-Item [-Path] <String> [-Recurse] [-ItemPathsAbsolute] [-Root <String>]

Export-Item -Id <String> [-Database <String>] [-Recurse] [-ItemPathsAbsolute] [-Root <String>]

Detailed Description

The Export-Item command serializes Sitecore items to the filesystem. The alias for the command is Serialize-Item. The simplest command syntax is: Export-Item -path "master:\content"

or

Get-Item "master:\content" | Export-Item

Both of them will serialize the content item in the master database. In first case we pass the path to the item as a parameter, in second case we serialize the items which come from the pipeline. You can send more items from the pipeline to the Export-Item command, e.g. if you need to serialize all the descendants of the home item created by sitecore\admin, you can use:

Get-Childitem "master:\content\home" -recurse | Where-Object { $_."__Created By" -eq "sitecore\admin" } | Export-Item

© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions## Aliases

The following abbreviations are aliases for this cmdlet:

  • Serialize-Item

Parameters

-Entry <IncludeEntry>

Serialization preset to be serialized. Obtain the preset through the use of Get-Preset command.

Aliases

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

true (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-Recurse <SwitchParameter>

Process the item and all of its children - switch which decides if serialization concerns only the single item or the whole tree below the item, e.g.

Export-Item -path "master:\content\articles" -recurse

Root - directory where the serialized files should be saved, e.g. Export-Item -path "master:\content" -Root "c:\tmp"

Aliases

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ItemPathsAbsolute <SwitchParameter>

Works only with Root parameter and decides if folder structure starting from "sitecore\content" should be created, e.g. if you want to serialize articles item in directory c:\tmp\sitecore\content you can use. For example: Export-Item -Path "master:\content\articles" -ItemPathsAbsolute -Root "c:\tmp"

Aliases

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Root <String>

Directory where the serialized files should be saved, e.g.

Export-Item -Path "master:\content" -Root "c:\tmp"

Aliases

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

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

-Path <String>

Path to the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required?

true

Position?

1

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Id <String>

You can pass the id of serialized item instead of path, e.g. Export-Item -id "{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}"

Aliases

Required?

true

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Database <String>

Aliases

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • Sitecore.Data.Items.Item

Notes

Help Author: Marek Musielak, Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Export-Item -Path master:\content\home

Related Topics