|  | ||
| 
 
 | API examples for newer versions Please visit the latest API Examples documentation to view API examples for newer versions of Kentico. | 
The following example moves Document 1 created by the code example in the Sample document structure topic the recycle bin.
| private bool MoveToRecycleBin() { // Create an instance of the Tree provider TreeProvider tree = new TreeProvider(CMSContext.CurrentUser); 
 // Get the document TreeNode node = tree.SelectSingleNode(CMSContext.CurrentSiteName, "/API-Example/Document-1", "en-us"); 
 if (node != null) { // Delete the document without destroying its history DocumentHelper.DeleteDocument(node, tree, true, false, true); 
 return true; } 
 return false; } | 
The following example restores the document moved to the recycle bin by the example above back to the content tree.
| private bool MoveToRecycleBin() { // Create an instance of the Tree provider TreeProvider tree = new TreeProvider(CMSContext.CurrentUser); 
 // Get the document TreeNode node = tree.SelectSingleNode(CMSContext.CurrentSiteName, "/API-Example/Document-1", "en-us"); 
 if (node != null) { // Delete the document without destroying its history DocumentHelper.DeleteDocument(node, tree, true, false, true); 
 return true; } 
 return false; } |