I am trying do Customization for the copying operation. when editors are doing item copy operation (Right Click Item > Copying > CopyTo), I need to restrict when the selected item having morethan two child levels then, I need to show a warning/Message "Item copying is failed". can you anyone suggest me, how can achieve this.

just I want to restrict the operation when child item leave is >2
The best way is probably to override the existing
Sitecore.Shell.Framework.Commands.CopyTocommand and implement your ownQueryStatelogic, where you basically just test ifcontext.Items[0]has more than two levels. Having a message appear might be tricky, so I'd suggest having theQueryStatemethod returnDisabledinstead. You should probably avoid traversing the item tree when testing how many levels you got. Traversing the item tree can be very slow if there are many items. Do some Solr Query for this instead.Once you have your own
CopyTocommand, patch thetypeattribute in<command name="item:copyto">configuration with your own class.