Wednesday, December 20, 2023

Sitecore Content Export by PowerShell

Hi All,

We recently received a request requiring us to export the content of different objects in every language. We attempted to accomplish it using Sitecore's "Export Language" default technique.

See the screenshot below for further information.

We aim to use PowerShell for that since we encountered a lot of problems and received unexpected data when we used the default technique. As everyone is aware, PowerShell is an incredibly useful tool that makes it easier to accomplish nearly anything in Sitecore.

We use the script below to extract the content, and it works great for us.

$path = "master:{A27BB959-5281-47EF-HJC9-1C471C43BE3B}"

$fieldName= Get-ItemField -Path $path

@(Get-Item -Path $path -Language *) | Show-ListView -prop $fieldName


But subsequently, we discovered that we also needed additional standard fields to distinguish the values in other languages, so we made a few little adjustments, and the result is shown below.


$path = "master:{A27BB959-5281-47EF-HJC9-1C471C43BE3B}"

$fieldName= Get-ItemField -Path $path

$fieldName += "Language"

$fieldName += "ItemPath"

@(Get-Item -Path $path -Language *) | Show-ListView -prop $fieldName


Similar to the script above, we can use the interactive dialog box—which we covered in our previous blog—to give it a more dynamic feel.

Although we are now limited to using raw code scripts, PowerShell offers unlimited possibilities for automation.

You may all experiment with this to add more movement and interest. Tell me whether you need my assistance, please.

Regards ahead of time.

I hope you enjoy this Sitecore blog. Stay tuned for more Sitecore related articles.

Till that happy Sitecoring :)

Please leave your comments or share this article if it’s useful for you.