2

in my app i want to get all paths of recent used document in windows 7 (for all types of documents) , i am using c# ,so is there any method to do that ? help me please? .

thanks

Radi
  • 6,548
  • 18
  • 63
  • 91

2 Answers2

12

Use Environment.SpecialFolder.Recent:

string path = Environment.GetFolderPath(Environment.SpecialFolder.Recent);
var files = Directory.EnumerateFiles(path);
as-cii
  • 12,819
  • 4
  • 41
  • 43
3

This kind of data is stored in the registry. A Google search led me to the following:

Description: Recently opened files from Windows Explorer Location: C:\Users\\AppData\Roaming\Microsoft\Windows\Recent

Description: Recently Opened Office Docs Location: C:\Users\\AppData\Roaming\Microsoft\Office\Recent

(from: http://www.irongeek.com/i.php?page=security/windows-forensics-registry-and-file-system-spots)

yurib
  • 8,043
  • 3
  • 30
  • 55
  • You don't want to count on those. They could change in future versions. Always use the special folder enums (or the C++ equivalent if you're in native code) so you are future proof. – Kate Gregory Jan 01 '11 at 16:20