Try our conversational search powered by Generative AI!

update ExistingBlock programatically !

Vote:
 

Hi All,

How can i update existing block programatically. I am able to create a new block and added it to contentArea but if i want to update this block, how can i do that? 

I have gone through this post for creating block:

https://world.episerver.com/forum/legacy-forums/Episerver-7-CMS/Thread-Container/2015/6/programmatically-adding-blocks-to-a-contentarea---error/#123186

#188315
Feb 19, 2018 16:21
Vote:
 

You can use the IContentRepository to load the block using the content reference. See more information here in the persisting a content instance section: 

https://world.episerver.com/documentation/developer-guides/CMS/Content/icontentrepository-and-datafactory/

the key method is CreateWritableClone()

#188324
Edited, Feb 20, 2018 0:15
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.