I recently tried using New-ItemClone command on SPE and encountered this error:

System.AggregateException,Cognifide.PowerShell.Commandlets.Data.Clones.NewItemCloneCommand

These are the codes used:

$master = Get-Item .
$destination = Get-Item -Path "master:\content"   
$siteName = "myNewSite"

$newSite = New-ItemClone $master -Destination $destination -Name $siteName -Recurse

enter image description here

I'm using Sitecore 8 update 2 and SPE 4.7.2

Any clue what this might be? I'm new to using Sitecore cloning. Is there a particular item that can't be cloned? I've searched for documentations but can't find a specific one for this error.

  • 1
    Could you check your Sitecore logs and search for errors? (there is an error in some item:saving handler) – Alan Płócieniak Jul 6 at 13:57
  • 1
    Do you have custom events in the item:saving? – Hishaam Namooya Jul 6 at 17:08
  • Yes, we have a custom event on the item:saving. I'll look into it more and come back to this – user6274 Jul 9 at 5:54
up vote 0 down vote accepted

So looking into my solution, I found out that this error is due to a custom item:saving event code that was being called when executing New-ItemClone command. Putting a condition when this New-ItemClone is executing fixes the problem

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.