Move document

Moving a document

 

[C#]

 

// Tree provider

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

 

// Get document (node) which will be moved

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

 

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

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

          

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

{

  // Move the document under the specified target

  provider.MoveNode(node, target.NodeID);

}