How do I restore a file from the recycle bin using C#?

爱⌒轻易说出口 提交于 2019-11-27 09:41:10

There seems not to be a solution in pure C#. You most likely have to resort to P/Invoke. This article presents a solution in C++ using the SHFileOperation API.

The only other reference to this beyond the previously mentioned link to codeproject that I can see mentions this:

Call SHGetFolderLocation passing CSIDL_BITBUCKET. Then you can manipulate that folder as usual. You'll have to create an interop for the SHGetFolderLocation function.

"CSIDL_BUCKET" being the constant for the virtual RecycleBin folder. The quote is taken from here, and will involve interop with the Windows shell. MSDN also mentions that this function has been deprecated in favour of another in Vista.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!