Copy document

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

Copying a document

 

[C#]

 

// Tree provider

CMS.TreeEngine.TreeProvider provider = new CMS.TreeEngine.TreeProvider(CMS.CMSHelper.CMSContext.CurrentUser);

// Get document (node) which will be copied

CMS.TreeEngine.TreeNode node = provider.SelectSingleNode(CMS.CMSHelper.CMSContext.CurrentSiteName, "/Products/PDAs/ItemA", "en-us");

// Get target node under which the document will be copied

CMS.TreeEngine.TreeNode target = provider.SelectSingleNode(CMS.CMSHelper.CMSContext.CurrentSiteName, "/Products/Notebooks", "en-us");

 

if ((target != null) && (node != null))

{

  // copy the document under the specified target,

  // the third parameter says that document`s child nodes (if any) will not be copied

  provider.CopyNode(node, target.NodeID, false);

}

 

Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?copy_document.htm