This is situation is for a standard user on Windows 7. There is no such
problem on pre-Vista Windows versions - and I assume the Windows 8 behaviour
is similar to that on Windows 7.

I want to use the Microsoft.VisualBasic assembly's FileSystem.Delete method
universally, but can't work out how to get around the problem that the
RecycleOption.SendToRecycleBin parameter is overridden once permission is
given by the user to delete the file, when that file is in a restricted
location like the root directory. 

 

My.Computer.FileSystem.DeleteFile(TestFilePath,

                                  FileIO.UIOption.AllDialogs,

                                  FileIO.RecycleOption.SendToRecycleBin,

                                  FileIO.UICancelOption.ThrowException)

If TestFilePath is "C:\test.file" then the usual security dialog occurs, and
on continuing & giving permission the file is deleted - but permanently. 

On the otherhand, in a location like the user's desktop
     (Environment.GetFolderPath(Environment.SpecialFolder.Desktop) &
"\Test.txt")

it does get deleted to the recycle bin. 

How can I have the files always go to the recycle bin (assuming the user
gives permission, as required)? 

  _____  

Ian Thomas
Victoria Park, Western Australia

Reply via email to