London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
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;
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