In short if you want to copy a block to some content asset folder I suggest you do as:
Something like this
var repo = ServiceLocator.Current.GetInstance<IContentRepository>();
var forAllSites = ContentReference.GlobalBlockFolder;
var newBlockInstance = repo.GetDefault<BlockType>(parentLink: forAllSites) as IContent;
I'm trying to copy a block to another page that will be migrated. The "copied" block should be saved in the content folder "For this page"
What is the best approach?
var textContainerClone = textContainer.CreateWritableClone() as IContent;
textContainerClone.ContentGuid = Guid.Empty;
textContainerClone.ParentLink = null;
I get the following error if I copy the block by code or in the cms:
Failed to copy page 'In the Field with GE Healthcare India' to 'In the Field With GE Healthcare India'.:[Importing content 71077_158727] Exception: Value cannot be null. Parameter name: source
There is another way to do this?