1

How can we identify all the Sitecore which are cloned item and how can we unclone them programmatically? Can we do this using Powershellscript?

2 Answers 2

2

You can get the cloned items for an item using the following code:

item.GetClones(true);

You can un-clone item using the following:

if (item.IsClone)
{
    var clone = new CloneItem(item);
    clone.Unclone();
}

You can get cloned items for an item using Sitecore PS as:

Get-ItemClone -Path master:\content\home

Following is the documentation of how you can get cloned-items for an item using powershell: https://doc.sitecorepowershell.com/appendix/common/get-itemclone

0

Basically if an sitecore Item have "__Source" field value populated, then it means it's an clone of another item.

So you can query (from code OR using powershell script) to find any items with that field is populated to find out all the clones.

Refer:

https://doc.sitecore.com/users/93/sitecore-experience-platform/en/clones.html

Does Sitecore cloning create extra records in Link Database?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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