Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Copy Blocks in Episerver programmatically and saving then in the content folder "For this page"

$
0
0

Hi everyone,

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;

this._contentRepository.Save(textContainerClone);

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?

Thank you


Viewing all articles
Browse latest Browse all 9076

Trending Articles