We want to create custom item duplicate functionality just like OOTB Duplicate option provided by Sitecore.

Has anyone implemented such functionality using either powershell or .net code. How we can do it?

2 Answers 2


First of all you need to duplicate the item /sitecore/content/Applications/Content Editor/Context Menues/Default/Duplicate from core db

enter image description here

On Message field you have item:duplicate command.

enter image description here

You need to create your custom command and to set it to the new created item. You need to register you custom command in a patch config file

<?xml version="1.0" encoding="utf-8" ?>
        <!-- COMMANDS -->
            <command name="item:customduplicate" type="YourNameSpace.CustomDuplicate,YourAssembly" />

The item:duplicate command looks like:

using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using System;

namespace YourNamespace
  /// <summary>Represents the Duplicate command.</summary>
  public class Duplicate : Command
    /// <summary>Executes the command in the specified context.</summary>
    /// <param name="context">The context.</param>
    public override void Execute(CommandContext context)
      if (context.Items.Length != 1 || context.Items[0] == null)

    /// <summary>Queries the state of the command.</summary>
    /// <param name="context">The context.</param>
    /// <returns>The state of the command.</returns>
    public override CommandState QueryState(CommandContext context)
      Error.AssertObject((object) context, nameof (context));
      if (context.Items.Length != 1)
        return CommandState.Disabled;
      Item parent = context.Items[0].Parent;
      return parent == null || !parent.Access.CanCreate() || !context.Items[0].Access.CanWriteLanguage() ? CommandState.Disabled : base.QueryState(context);
  • I want to allow duplicate item for those who don't have delete access. I am trying to run below line using SecurityDisabler- Sitecore.Shell.Framework.Items.Duplicate(context.Items[0]); But still its not allowing to duplicate the item. Can we programmatically assign delete access to the context user? or any other way we can think of? Mar 1, 2022 at 11:15
  • are you duplicating with same name like the orginal item ? Mar 1, 2022 at 11:19
  • No...we are not duplicating with same name. Duplicate in bucket works like- it will create new item as the original item and then move it according to bucket folder structure. And to move we need to delete that item and create at the destination. We don't want to change our access rights i.e. allow delete access to authors. So we are trying to create custom duplicate option. Mar 1, 2022 at 12:04

Based on your comments about custom duplication logic as well as duplication of items in buckets, it sounds like you might need/want to also hook into some of the events / processors related to item duplication.

    <processor type="Sitecore.Shell.Framework.Pipelines.DuplicateItem,Sitecore.Kernel" method="CheckPermissions" mode="on"/>
    <processor method="CustomMethodName" mode="on" type="Custom.Project.Web.Pipelines.DuplicateItem.CustomDuplicateItem, Custom.Project.Web" patch:source="Custom.config"/>
    <processor type="Sitecore.Buckets.Pipelines.UI.ItemDuplicate, Sitecore.Buckets" method="Execute" mode="on" patch:source="Sitecore.Buckets.config"/>
    <processor type="Sitecore.Shell.Framework.Pipelines.DuplicateItem,Sitecore.Kernel" method="Execute" mode="on"/>

More info on events can be found in this older documentation here. Inspecting your ShowConfig.aspx will also reveal other possibilities with events. For example:

<!--  Event hook after duplicating an item into an item bucket.
           Args: (ClientPipelineArgs) Args ->  -->
<event name="item:bucketing:duplicating" patch:source="Sitecore.Buckets.config"/>

For code examples, simply decompile the binaries mentioned in the settings.

Your Answer

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

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