Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sitecore Powershell Deserialization

I am trying to perform deserialization with Sitecore Powershell Extensions 251. I cant get deserialization to work. Here is what I did :

  • I serialized the item sitecore\content\settings\testItem. Serialization was successful, package was created.

    Get-Item "master:\content\settings\testItem" | Serialize-Item -Recurse

  • I delete the item sitecore\content\settings\testItem and try to deserialize it with the command :

    Deserialize-Item -Path master:\content\settings\TestItem -Recurse

I get the following exception :

writeErrorStream      : True
Exception             : System.Exception: path is not under the root
                           bei Sitecore.Data.Serialization.PathUtils.GetShortPath(String path)
                           bei Sitecore.Data.Serialization.Manager.LoadTree(String path, LoadOptions options)
                           bei Cognifide.PowerShell.PowerShellIntegrations.Commandlets.Serialization.DeserializeItemCommand.Deserialize(String path)
                           bei Cognifide.PowerShell.PowerShellIntegrations.Commandlets.Serialization.DeserializeItemCommand.ProcessRecord()
                           bei System.Management.Automation.CommandProcessor.ProcessRecord()
TargetObject          :
CategoryInfo          : NotSpecified: (:) [Deserialize-Item], Exception
FullyQualifiedErrorId : System.Exception,Cognifide.PowerShell.PowerShellIntegrations.Commandlets.Serialization.DeserializeItemCommand
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
PipelineIterationInfo : {0, 1}
PSMessageDetails      :

I have searched the web, but I could not find documentation/examples for deserialization. Can anyone write me how to do the deserialization, and if available, refer to the documentation or example resources on the web?`

Thanx

like image 423
EngelbertCoder Avatar asked Nov 28 '13 12:11

EngelbertCoder


1 Answers

deserialize-item coomand requires 2 parameters:

  1. Path - path on the hard drive to the directory
  2. Root - the location of the serialization directory

and Recurse optionally, e.g:

deserialize-item -Path "C:\project\data\serialization\master\sitecore\content\settings" -Root "C:\project\data\serialization\" -Recurse

Update the beginning of the page in the code above so they match your environment.

Here is a blog post explaining serialization and deserialization with Sitecore Powershell Extensions.

like image 77
Marek Musielak Avatar answered Oct 03 '22 06:10

Marek Musielak