C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Active Directory »

Send a File to recycle bin on deletion


Posted Date: 09 Jun 2008    Resource Type: Code Snippets    Category: Active Directory
Author: Payal JainMember Level: Gold    
Rating: 1 out of 5Points: 10



Introduction


This code will help you know how we can send a File to recycle bin on deletion.

namespace


Namespace used for this is Microsoft.VisualBasic.MyServices which will be imported to your application using:

using Microsoft.VisualBasic.MyServices;

at the top of the file.

Referrences to be added to your project


you may need to add reference to microsoft.visualbasic.dll to your project.

code and its description







FileSystemProxy FileSystem = new Microsoft.VisualBasic.Devices.Computer().FileSystem;
FileSystem.DeleteFile(@"C:\myfolder\myFile.txt", Microsoft.VisualBasic.FileIO.UIOption.AllDialogs, Microsoft.VisualBasic.FileIO.RecycleOption.SendToRecycleBin);

FileSystem = null;



In the function DeleteFile of FileSystem object you need to pass 3 arguments, 1st is the original path of the file and second is the Enum which Specifies which dialog boxes to show when copying, deleting, or moving files or directories.
3rd is also an enum which Specifies whether a file should be deleted permanently or placed in the Recycle Bin.if you want to delete it permanently use Microsoft.VisualBasic.FileIO.RecycleOption.DeletePermanently in 3rd argument.




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Recycle bin  .  Delete and send to recycle bin  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: How to delete a directory and send it to recycle bin
Previous Resource: Getting Names of Computers in WorkGroup
Return to Discussion Resource Index
Post New Resource
Category: Active Directory


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use