More in this section

Forums / Developing with Sitefinity / How to copy IContent?

How to copy IContent?

2 posts, 0 answered
  1. bemara57
    bemara57 avatar
    135 posts
    Registered:
    27 Mar 2008
    13 May 2010
    Link to this post
    I would like to copy an IContent object with all it's meta data. I see that the API has CreateContent() and SaveContent(), but I am looking for something like CopyContent(guid id). What is the proper way of doing this?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    13 May 2010
    Link to this post
    Hello bemara57,

    There is no method that you could use to copy/duplicate an IContent item. You could get/set metadata by using GetMetaData and SetMetaData methods of an IContent object. After you have the content item you could use the following code to get all metakeys and set them to a new content. The metakeys are set per provider and if you need to get them you could use cntManager.Provider.MetaKeys

    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
2 posts, 0 answered